<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><style><!--/*paged media */ div.header {display: none }div.footer {display: none } /*@media print { */@page { size: A4; margin: 10%; @top-center {content: element(header) } @bottom-center {content: element(footer) } }/*element styles*/ .del  {text-decoration:line-through;color:red;} .ins {text-decoration:none;background:#c0ffc0;padding:1px;}
 /* TABLE STYLES */ 
table.TableNormal {display:table;position: relative; margin-left: 0in;}
table.TableGrid {display:table;position: relative; margin-left: 0in;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;margin-bottom: 0in;line-height: 100%;}

 /* PARAGRAPH STYLES */ 
.DocDefaults {display:block;margin-bottom: 4mm;line-height: 115%;font-size: 11.0pt;}
.Normal {display:block;}
.NormalWeb {display:block;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;font-size: 12.0pt;}
.Command {display:block;position: relative; margin-left: 0.5in;font-size: 10.0pt;}
.Heading1 {display:block;page-break-after: avoid;nullmargin-top: 0.33in;margin-bottom: 4mm;font-weight: bold;color: #365F91;font-size: 18.0pt;}
.Footer {display:block;margin-bottom: 0in;line-height: 100%;null}
.FootnoteText {display:block;margin-bottom: 0in;line-height: 100%;font-size: 10.0pt;}
.Header {display:block;margin-bottom: 0in;line-height: 100%;null}
.Heading2 {display:block;nullmargin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;font-weight: bold;font-style: italic;font-size: 14.0pt;}
.Title {display:block;border-bottom-style: solid;border-bottom-width: 0.35mm;border-bottom-color: #4F81BD;margin-bottom: 0.21in;line-height: 100%;color: #17365D;font-size: 26.0pt;}
.ListParagraph {display:block;position: relative; margin-left: 0.5in;}
.dependency-TableGrid-BR {display:block;margin-bottom: 0in;line-height: 100%;color: #3F5FBF;font-size: 8.0pt;}
.Normal-TableGrid-BR {display:block;margin-bottom: 0in;line-height: 100%;font-size: 11.0pt;}
.ListParagraph-TableGrid-BR {display:block;position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;font-size: 11.0pt;}

 /* CHARACTER STYLES */ span.DefaultParagraphFont {display:inline;}
span.FootnoteReference {display:inline;vertical-align: top;font-size: xx-small;}
span.apple-style-span {display:inline;}
span.xmlmarkupattributename {display:inline;}
span.Strong {display:inline;font-weight: bold;}
span.xmlmarkuptagname {display:inline;}
span.Emphasis {display:inline;font-style: italic;}
span.xmlmarkupattributevalue {display:inline;}
span.underline {display:inline;}
span.Hyperlink {display:inline;color: #0000FF;text-decoration: underline;}
span.HTMLCode {display:inline;font-size: 10.0pt;}
span.icon {display:inline;}
span.apple-converted-space {display:inline;}
span.xmlmarkupbracket {display:inline;}
html, body, div, span, h1, h2, h3, h4, h5, h6, p, a, img,  ol, ul, li, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0;}body {line-height: 1;} --></style><script type="text/javascript"><!--function toggleDiv(divid){if(document.getElementById(divid).style.display == 'none'){document.getElementById(divid).style.display = 'block';}else{document.getElementById(divid).style.display = 'none';}}
--></script></head><body>
  
  <!-- userBodyTop goes here -->
  
  
  
  <div class="document">
  
  <p class="Title Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Docx4j - Getting Started</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">This guide is for docx4j </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri';">3.2.0</span><span class="" style="font-family: 'Calibri';">.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The latest version of this document can always be found in </span><a href="https://github.com/plutext/docx4j/tree/master/docs"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">docx4j on GitHub in /docs</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /><span class="" style="font-family: 'Calibri';">.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The most up to date copy of this document is in English.  There is also a Russian version.  From time to time, it may be machine translated into other languages.  Please let us know if you are interested in writing some basic documentation in your own language (either as a contribution, or for a fee). </span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">What is docx4j?</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">docx4j is a library for </span><span class="" style="font-family: 'Calibri';">working with docx, pptx and xlsx files in Java.  In essence, it can unzip a</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> docx </span><span class="" style="font-family: 'Calibri';">(or pptx/xlsx) "package", and parse</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> the XML to create an in-memory representation in </span><span class="" style="font-family: 'Calibri';">Java</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> using developer friendly classes (as opposed to DOM or SAX).  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">docx4j is usually deployed as part of a web application (eg on Tomcat, JBOSS, WebSphere etc – see the deployment forums).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">docx4j</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> is similar in concept to Microsoft's  OpenXML SDK, which is for .NET.  docx4j.NET is available for the NET platform; see further below.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">A strength of docx4j is that its in-memory representation uses </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri';">JAXB</span><span class="" style="font-family: 'Calibri';">, the JCP standard for Java - XML binding.  In this respect, Aspose is similar to it.  In contrast, Apache POI uses XML Beans.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">docx4j is open source, available under the Apache License (v2).  As an open source project, docx4j has been substantially improved by a number of contributions (see the README or POM file for contributors), and further contributions are always welcome.  Please see the docx4j forum at </span><a href="http://www.docx4java.org/forums/"><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri';">http://</span><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri';">www.docx4java</span><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri';">.org/forums/</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> for details.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">The docx4j project is sponsored by Plutext (</span><a href="http://www.plutext.com"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">www.plutext.com</span></a><span class="" style="font-family: 'Calibri';">).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">There is also a commercial enterprise edition of docx4j, which comes with commercial support and additional functionality not found in the community edition.  Additional functionality includes:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Merging documents or presentations</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">OLE embedding of files in docx, pptx, xlsx</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">TOC generation/updating</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">What sorts of things can you do with docx4j?</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Open existing docx (from filesystem, SMB/CIFS, WebDAV using VFS), pptx, xlsx</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Create new docx, pptx, xlsx</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Programmatically manipulate the above (of course)</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Save to various media zipped, or unzipped</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Produce/consume  the Flat OPC XML format</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Do all this on Android (v3 or 4).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Specific to docx4j (as opposed to pptx4j, xlsx4j):</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Import XHTML</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Export as (X)HTML or PDF</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Template substitution; CustomXML binding</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Mail merge</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Apply transforms, including common filters</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Diff/compare documents, paragraphs or sdt (content controls)</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Font support (font substitution, and use of any fonts embedded in the document)</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">This document focuses primarily on docx4j, but the general principles are equally applicable to pptx4j and xlsx4j.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Is docx4j for you?</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Docx4j is for processing docx documents (and pptx presentations and xlsx spreadsheets) in Java.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">It isn't for old binary (.doc) files.  If you wish to invest your effort around docx (as is wise), but you also need to be able to handle old doc files, see further below for your options. </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Nor is it for RTF files.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">docx4j.NET</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">If you want to process docx/pptx/xslsx on the .NET platform, you should </span><span class="" style="font-family: 'Calibri';">consider</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> Microsoft's </span><span class="" style="font-family: 'Calibri';">OpenXML SDK.</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">  That said, docx4j can be used in a .NET environment via IKVM, and there are several reasons you might wish to do this:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Where you need docx4j</span><span style="font-family: 'Calibri';">’</span><span style="font-family: 'Calibri';">s capabilities, for example:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">XHTML import</span><span style="font-family: 'Calibri';">/export/roundtrip</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">PDF export</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">OpenDoPE processing</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">Capabilities provided by docx4j </span><span style="font-family: 'Calibri';">enterprise edition (as to which see above)</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Where you need to work in both Java and .NET, and want to use a single API in both environments</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">Where you need the source code (Microsoft doesn</span><span style="font-family: 'Calibri';white-space:pre-wrap;">’</span><span style="font-family: 'Calibri';white-space:pre-wrap;">t </span><span style="font-family: 'Calibri';">provide that)</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">You can use docx4j.NET and the OpenXML SDK together; see </span><a href="https://github.com/plutext/docx4j.NET/blob/master/docx4j.NET/src/samples/c%23/Docx4NET/InteropDocx.cs"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">InteropDocx</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">As on the Java platform, docx4j.NET comes in community and commercial editions.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">See </span><a href="https://www.nuget.org/packages/docx4j.NET/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">https://www.nuget.org/packages/docx4j.NET/</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">What Word documents does it support?</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Docx4j can read/write docx documents created by or for Word 2007</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> or later, </span><span class="" style="font-family: 'Calibri';">plus</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> earlier versions which have the compatibility pack installed. (Same goes for xlsx spreadsheets and pptx presentations).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">The relevant parts of docx4j are generated from the ECMA schemas</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">, with the addition of the key </span><span class="" style="font-family: 'Calibri';">Microsoft proprietary extensions.</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">  For unsupported extensions, docx4j gracefully degrades to the specified 2007 substitutes.</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">It </span><span class="" style="font-family: 'Calibri';">is not really intended</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> read/write Word 2003 XML documents, although </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">package</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> org.docx4j.convert.in.word2003xml </span></span><span class="" style="font-family: 'Calibri';">is a proof of concept of importing such documents.</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">For more information, please see </span><a href="#_Ref280708892"><span class="DefaultParagraphFont " style="font-weight: bold;font-style: italic;;font-family: 'Calibri';">Specification versions</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> below.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Handling legacy binary .doc files</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Apache POI's HWPF can read .doc files, and docx4j</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">’s </span><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Consolas';white-space:pre-wrap;">org.docx4j.convert.in.Doc </span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">does </span><span class="" style="font-family: 'Calibri';">use this for basic conversion of .doc to .docx.  The problem with this approach is that POI's HWPF code fails on many .doc files.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">An effective approach is to use LibreOffice or OpenOffice (via jodconverter) to convert the doc to docx, which docx4j can then process.  If you need to return a binary .doc, LibreOffice or </span><span class="" style="font-family: 'Calibri';">OpenOffice/jodconverter can convert the docx back to .doc.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Getting Help: the docx4j forum</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Free community support is available in the docx4j forum, at </span><a href="http://www.docx4java.org/forums/"><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri';">http://www.docx4java.org/forums/</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';">and on Stack Overflow.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Before posting, please:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">check this document doesn</span><span style="font-family: 'Calibri';">’</span><span style="font-family: 'Calibri';">t answer your question</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">try to help yourself: people are unlikely to help you if it looks like you are asking someone else to do lots of work you presumably are being paid to do!</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">ensure your post says which version of docx4j you are using, and contains your Java code (between [java] .. and .. [/java]) and XML (between [xml] .. and .. [/xml])</span><span style="font-family: 'Calibri';">, and if appropriate a docx/pptx/xlsx attachment</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">consider browsing relevant docx4j source code </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">This discussion is generally in English.  If you </span><span class="" style="font-family: 'Calibri';">would like</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> to moderate a forum in another language (for example, French, Chinese, Spanish…), please let us know.</span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Using docx4j via Maven</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">docx4j is in Maven Central.  For Maven users, t</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">his makes it really easy to get going with docx4j.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">With Eclipse and m2eclipse installed, you just add docx4j, and you’re done.  No need to mess around with manually installing</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> jars, setting class paths etc.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The blog entry </span><a href="http://www.docx4java.org/blog/2011/10/hello-maven-central/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">hello-maven-central</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';">shows you what to do, starting with a fresh OS (Win 7 is used, but these steps would work equally well on OSX or Linux).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Using docx4j binaries</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">If Maven is not for you, y</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">ou can download the latest version of docx4j from </span><a href="http://www.docx4java.org/docx4j/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">http://</span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">www.docx4java</span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">.org/docx4j/</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">In general, we suggest you develop against a currently nightly build, since the latest formal release can often be several months old.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Supporting jars can be found in the .tar.gz or zip version, or in the relevant subdirectory.  </span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Command Line Samples</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">There are several samples you can run right away from the command line.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The </span><span class="" style="font-family: 'Calibri';">three</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> to try (both discussed in detail further below) are:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">CreateDocx</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">OpenMainDocumentAndTraverse</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">PartsList</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Invoke with a command like:</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.5in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Courier New';">java -cp docx4j-3.0.1.jar:log4j-1.2.17.jar;</span><span class="DefaultParagraphFont " style="color: #222222;background-color: #FFFFFF;font-size: 6.5pt;;font-family: 'Courier New';">slf4j-api-1.7.5.jar;slf4j-log4j12-1.7.5.jar</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Courier New';white-space:pre-wrap;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;"><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Courier New';">org.docx4j.samples.OpenMainDocumentAndTraverse [input.docx]</span></p>
  
  <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Trebuchet MS';">If there are any images in the docx, you'd also need:</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Trebuchet MS';">xmlgraphics-commons-1.5</span></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Trebuchet MS';">.jar</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Trebuchet MS';">commons-logging-1.1.1.jar</span></span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">on your classpath.</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">  For convenience, here is the classpath including all docx4j dependencies</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="DefaultParagraphFont " style="color: #222222;background-color: #FFFFFF;font-size: 9.0pt;;font-family: 'Courier New';">docx4j-3.0.1.jar;antlr-2.7.7.jar;antlr-runtime-3.3.jar;avalon-framework-api-4.3.1.jar;avalon-framework-impl-4.3.1.jar;batik-anim-1.7.jar;batik-awt-util-1.7.jar;batik-bridge-1.7.jar;batik-css-1.7.jar;batik-dom-1.7.jar;batik-ext-1.7.jar;batik-extension-1.7.jar;batik-gvt-1.7.jar;batik-js-1.7.jar;batik-parser-1.7.jar;batik-script-1.7.jar;batik-svg-dom-1.7.jar;batik-svggen-1.7.jar;batik-transcoder-1.7.jar;batik-util-1.7.jar;batik-xml-1.7.jar;commons-codec-1.3.jar;commons-io-1.3.1.jar;commons-lang-2.4.jar;commons-logging-1.1.1.jar; fop-1.1.jar;jaxb-svg11-1.0.2.jar;jaxb-xmldsig-core-1.0.0.jar;jaxb-xslfo-1.0.1.jar;log4j-1.2.17.jar;poi-3.8.jar;poi-scratchpad-3.8.jar;serializer-2.7.1.jar;slf4j-api-1.7.5.jar;slf4j-log4j12-1.7.5.jar;stringtemplate-3.2.1.jar;wmf2svg-0.9.0.jar;xalan-2.7.1.jar;xmlgraphics-commons-1.5.jar</span><span class="apple-converted-space DefaultParagraphFont " style="color: #222222;background-color: #FFFFFF;font-size: 9.0pt;;font-family: 'Courier New';"> </span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">docx4j dependencies</span></p>
  
  <p class="Heading2 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">slf4j</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">To do anything with docx4j, you need </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri';">slf4j</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> on your classpath.  As the slf4j website puts it:</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="DefaultParagraphFont " style="color: #777777;background-color: #FFFFFF;font-size: 10.0pt;"><span class="" style="font-family: 'Verdana';">The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the desired logging framework at </span></span><span class="Emphasis DefaultParagraphFont " style="color: #777777;background-color: #FFFFFF;font-size: 10.0pt;;font-family: 'Verdana';">deployment</span><span class="apple-converted-space DefaultParagraphFont " style="color: #777777;background-color: #FFFFFF;font-size: 10.0pt;;font-family: 'Verdana';"> </span><span class="DefaultParagraphFont " style="color: #777777;background-color: #FFFFFF;font-size: 10.0pt;;font-family: 'Verdana';">time.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">(In 2.8.1 and earlier, docx4j used log4j directly)</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Verdana';">So you need the slf4j api jar on your classpath:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">  </span><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">&lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">dependency</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">groupId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">org.slf4j</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">groupId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">artifactId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">slf4j-api</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">artifactId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">version</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">1.7.5</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">version</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">  &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">dependency</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Verdana';">If you want to use log4j, then include it, and:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">  &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">dependency</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">groupId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">org.slf4j</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">groupId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">artifactId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">slf4j-log4j12</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">artifactId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">version</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">1.7.5</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">version</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">  &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">dependency</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Heading2 Normal DocDefaults "><span class="" style="font-family: 'Cambria';white-space:pre-wrap;">other dependencies </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Depending what you want to do, the other</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> dependencies will be required (as outlined in appendix 1).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Best practice is to include all dependencies on your class path, and be done with it.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">In your development environment, you can do this using Maven, or by physically copying them all to your classpath.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">For your deployment environment, your build process ought to be set up to do this for you.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">JDK versions</span></p>
  
  <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="font-family: 'Calibri';">You need to be using Java 1.5+.</span><span class="apple-style-span DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;">  </span><span class="apple-style-span DefaultParagraphFont " style="font-family: 'Calibri';">This is because of JAXB</span><span class="FootnoteReference DefaultParagraphFont " style="vertical-align: top; font-size: xx-small"><a name="fs1"><a href="#fn1">1</a></a></span><span class="apple-style-span DefaultParagraphFont " style="font-family: 'Calibri';">.  If you must use  1.4, retrotranslator can</span><span class="apple-converted-space DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;"> </span><a href="http://forums.java.net/jive/message.jspa?messageID=212494"><span class="icon DefaultParagraphFont " style="font-family: 'Calibri';">reportedly make</span></a><span class="apple-converted-space DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;" /><span class="apple-style-span DefaultParagraphFont " style=""><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> it work.</span></span></p>
  
  <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="font-family: 'Calibri';">If you are using 1.5 only, and want to do differencing, you will need stax (uncomment it in pom.xml).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">A word about Jaxb</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">docx4j uses JAXB to marshall and unmarshall the </span><span class="" style="font-family: 'Calibri';">XML</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> parts in a </span><span class="" style="font-family: 'Calibri';">docx/pptx/xlsx.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">JAXB is included in Sun's Java 6 distributions, but not 1.5.  So if you are using the 1.5 JDK, you will need JAXB 2.1.x on your class path. </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">You can also use the JAXB reference implementation</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> (eg v2.2.4).  If you want to use that in preference to </span><span class="" style="font-family: 'Calibri';">the version included in the JDK, do so using the endorsed directory mechanism.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Since</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> docx4j 3.0, you can choose to use MOXy instead.  </span><span class="DefaultParagraphFont " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;;font-family: 'Verdana';">To do so, simply include</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;;font-family: 'Verdana';"> </span><a href="http://www.docx4java.org/docx4j/docx4j-MOXy-JAXBContext-3.0.0.jar"><span class="Hyperlink DefaultParagraphFont " style="color: #B85B5A;background-color: #FFFFFF;font-size: 10.0pt;;font-family: 'Verdana';">docx4j-MOXy-JAXBContext-3.0.0.jar</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;;font-family: 'Verdana';"> </span><span class="DefaultParagraphFont " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;;font-family: 'Verdana';">and the MOXy jars on your classpath.</span><span class="DefaultParagraphFont " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;"><span class="" style="font-family: 'Verdana';white-space:pre-wrap;">  If you are using Maven, this means adding the following to your POM:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">dependency</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         </span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">groupId</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">org.docx4j</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">groupId</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         </span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">artifactId</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">docx4j-MOXy-JAXBContext</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">artifactId</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         </span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">version</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">3.0.0</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">version</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">dependency</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">dependency</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         </span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">groupId</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">org.eclipse.persistence</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">groupId</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         </span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">artifactId</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">org.eclipse.persistence.moxy</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">artifactId</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         </span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">version</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">2.5.1</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">version</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #3F7F7F;font-size: 8.0pt;;font-family: 'Consolas';">dependency</span><span class="DefaultParagraphFont " style="color: #008080;font-size: 8.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Docx4j source code</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Docx4j</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> source is on GitHub at </span><a href="https://github.com/plutext/docx4j"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">https://github.com/plutext/docx4j</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> .  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">We accept pull requests; pull requests are presumed to be contributions under ASLv2 per our contributor agreement.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">See </span><a href="http://www.docx4java.org/blog/2012/05/docx4j-from-github-in-eclipse/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">docx4j-from-github-in-eclipse</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> for details.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Source code can also be downloaded from Maven Central (search for docx4j at search.maven.org).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Our old </span><span class="" style="font-family: 'Calibri';">subversion repository</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">at </span><a href="http://dev.plutext.org/svn/docx4j/trunk/docx4j"><span class="icon DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Consolas';">http://www.docx4java.org/svn/docx4j/trunk/docx4j</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">is obsolete.  </span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Javadoc</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Javadoc can be downloaded from Maven Central (search for docx4j at search.maven.org), but you’ll find the source code much more useful!  See above.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';white-space:pre-wrap;">Building docx4j from source </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Get the source code from GitHub (see above), then…</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> (you probably want to skip down to the next page, to get it working in Eclipse).</span></p>
  
  <p class="Heading2 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Command line -via Maven</span></p>
  
  <p class="Command NormalWeb Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">export MAVEN_OPTS=-Xmx512m</span><span class="DefaultParagraphFont " style="color: #000000;"><br /></span><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">mvn install </span></p>
  
  <p class="Heading2 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Command line - via Ant</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Before you can build via ant, you need to obtain docx4j's dependencies.  You can get them from the binary distribution, or via maven.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Edit build.xml, so the pathelements point to where you placed the dependencies.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Then</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Consolas';">ant dist</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">or on Linux</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Consolas';">ANT_OPTS="-Xmx512m -XX:MaxPermSize=256m" ant dist</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">That ant command will create the docx4j.jar and place it and all its dependencies in the dist dir.</span></p>
  
  <p class="Heading2 Normal DocDefaults " style="page-break-after: avoid;"><span class="" style="font-family: 'Cambria';">Eclipse</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">See </span><a href="http://www.docx4java.org/blog/2012/05/docx4j-from-github-in-eclipse/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">docx4j-from-github-in-eclipse</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /><span class="" style="font-family: 'Calibri';">.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Not working?</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Enable Maven (make sure you have Maven and its plugin installed - see Prerequisites above):</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">with Eclipse Indigo</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Right click on the project</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Click "Configure &gt; Convert to Maven Project"</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">with earlier versions of Eclipse</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Run mvn install in the docx4j dir from a command prompt (just in case)</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Right click on project &gt; Maven 2 &gt; EnableDependency Management</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Set compiler version &amp; system library:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Right click on the project (or Alt-Enter)</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Choose "Java Compiler", then set JDK compliance to 1.6</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Choose "Java Build Path", and check you are using 1.6 "JRE System Library". If not, remove, then click "Add Library"</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Now, we need to check the </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri';">class path</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> etc within Eclipse so that it can build.</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Build Path &gt; Configure Build Path &gt; Java Build Path &gt; Source tab</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">Verify it contains</span><span style="font-family: 'Calibri';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';white-space:pre-wrap;">(remove "Excluded: **" if present!)</span><span style="font-family: 'Calibri';">:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">src/main/java</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">src/pptx4j/java </span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">src/xslx4j/java</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">src/diffx</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">src/glox4j</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">The project should now be working in Eclipse without errors</span><span class="FootnoteReference DefaultParagraphFont " style="vertical-align: top; font-size: xx-small"><a name="fs2"><a href="#fn2">2</a></a></span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">. </span></p>
  
  <p class="Heading2 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Using a different IDE?</span></p>
  
  <p class="Normal DocDefaults "><span class="underline DefaultParagraphFont " style="font-family: 'Calibri';">Please post setup instructions in the forum, or as a wiki page on GitHub.  Thanks!</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Open an existing docx/pptx/xlsx document</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java"><span class="DefaultParagraphFont " style="font-family: 'Consolas';">org.docx4j.openpackaging.packages.</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';">WordprocessingMLPackage</span></a><span style="font-family: 'Calibri';"> represents a docx document.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">To load a document</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> or “Flat OPC” XML file</span><span class="" style="font-family: 'Calibri';">, all you have to do is:</span></p>
  
  <p class="Command NormalWeb Normal DocDefaults " style="position: relative; margin-left: 0in;">   <span style="font-family: 'Consolas';white-space:pre-wrap;">WordprocessingMLPackage wordMLPackage = </span><br />      <span style="font-family: 'Consolas';">WordprocessingMLPackage.load(new java.io.File(inputfilepath));</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">With docx4j 3.0, you can use the façade:</span></p>
  
  <p class="Command NormalWeb Normal DocDefaults " style="position: relative; margin-left: 0in;">   <span style="font-family: 'Consolas';white-space:pre-wrap;">WordprocessingMLPackage wordMLPackage = </span><br />      <span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';">Docx4J</span><span style="font-family: 'Consolas';">.load(new java.io.File(inputfilepath));</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">which does the same thing under the covers.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">There are similar signatures to load from an input stream.  </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">You can then get the main document part (word/document.xml):</span></p>
  
  <p class="Command NormalWeb Normal DocDefaults "><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/MainDocumentPart.java"><span class="DefaultParagraphFont " style="font-family: 'Calibri';">MainDocumentPart</span></a><span style="font-family: 'Consolas';"> documentPart = wordMLPackage.getMainDocumentPart();</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">After that, you can manipulate its contents. </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">A similar approach works for pptx files:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">PresentationMLPackage presentationMLPackage = </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Consolas';">(PresentationMLPackage)OpcPackage.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: 'Consolas';">load</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">(</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">new</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> java.io.File(inputfilepath));</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">And similarly for xlsx files.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">OpenXML</span><span class="" style="font-family: 'Cambria';white-space:pre-wrap;"> concepts</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">To do anything much beyond this, you need to have an understanding of basic WordML concepts</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> (or PresentationML or SpreadsheetML)</span><span class="" style="font-family: 'Calibri';">.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">According to the Microsoft Open Packaging spec, each docx document is made up of a number of “Part” files, zipped up.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">An easy way to get an understanding of this is to unzip a docx/pptx/xlsx using your favourite zip utility.  Even easier is to visit </span><a href="http://webapp.docx4java.org"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">http://webapp.docx4java.org</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">  and explore your file using “PartsList”.  You can also generate code that way.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">A Part is usually XML, but might not be (an image part, for example, isn't).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">The parts form a tree. If a part has child parts, it must have a relationships part which identifies these.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">The part which contains the main text of the document is the Main Document Part.  Each Part has a name.  The name of the Main Document Part is usually "/word/document.xml".</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">If the document has a header, then the main document part woud have a header child part, and this would be described in the main document part's relationships (part).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Similarly for any images.  To see the structure of any given document, </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">upload it to the PartsList webapp</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">, or run the "Parts List" sample (see </span><span class="" style="font-family: 'Calibri';">further below).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">An introduction to WordML is beyond the scope of this document.  You can find a very readable introduction in 1</span><span class="DefaultParagraphFont " style="vertical-align: top;font-size: xx-small;;font-family: 'Calibri';">st</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> edition Part 3 (Primer) at </span><a href="http://www.ecma-international.org/publications/standards/Ecma-376.htm"><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri';">http://www.ecma-international.org/publications/standards/Ecma-376.htm</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> or </span><a href="http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm"><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri';">http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> (a better link for the 1st edition (Dec 2006), since its not zipped up). </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">See also the free </span><a href="http://openxmldeveloper.org/cfs-file.ashx/__key/communityserver-components-postattachments/00-00-00-19-70/Open-XML-Explained.pdf"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">"Open XML Explained" ebook</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';">by Wouter Van Vugt</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">.  </span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Ref280708892" /><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Specification versions</span><span class="DefaultParagraphFont " style="font-family: 'Cambria';white-space:pre-wrap;"> </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">From Wikipedia:</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">The</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';"> </span><a alt="Office Open XML" href="http://en.wikipedia.org/wiki/Office_Open_XML"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;;font-family: 'Calibri';">Office Open XML</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';white-space:pre-wrap;">file formats were standardised between December 2006 and November 2008, </span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">first by the</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';"> </span><a alt="Ecma International" href="http://en.wikipedia.org/wiki/Ecma_International"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;;font-family: 'Calibri';">Ecma International</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">consortium (where they became</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';"> </span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;;font-family: 'Calibri';">ECMA-376</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';white-space:pre-wrap;">), </span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">and subsequently .. by the</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';"> </span><a alt="International Organization for Standardization" href="http://en.wikipedia.org/wiki/International_Organization_for_Standardization"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;;font-family: 'Calibri';">ISO</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';" /><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">/</span><a alt="International Electrotechnical Commission" href="http://en.wikipedia.org/wiki/International_Electrotechnical_Commission"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;;font-family: 'Calibri';">IEC</span></a><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">'s</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';"> </span><a alt="International Organization for Standardization" href="http://en.wikipedia.org/wiki/International_Organization_for_Standardization#ISO.2FIEC_Joint_Technical_Committee_1"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;;font-family: 'Calibri';">Joint Technical Committee 1</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">(where they became</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';"> </span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;;font-family: 'Calibri';">ISO/IEC 29500:2008</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The Ecma-376.htm link also contains the 2nd edition documents (of Dec 2008), which are </span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';">"</span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';">technically aligned with ISO/IEC 29500".</span></p>
  
  <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';">Office 2007 SP2 implements ECMA-376 1st Edition</span><span class="FootnoteReference DefaultParagraphFont " style="color: #333333;;vertical-align: top; font-size: xx-small"><a name="fs3"><a href="#fn3">3</a></a></span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';white-space:pre-wrap;">; this is what docx4j </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';">started with</span></p>
  
  <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';">ISO/IEC 29500 (ECMA-376 2nd Edition) has</span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-style: italic;;font-family: 'Calibri';">Strict</span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';">and</span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-style: italic;;font-family: 'Calibri';white-space:pre-wrap;">Transitional </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';">conformance classes.  Office 2010 supports</span><span class="FootnoteReference DefaultParagraphFont " style="color: #333333;;vertical-align: top; font-size: xx-small"><a name="fs4"><a href="#fn4">4</a></a></span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> transitional, and also has read only support for strict.</span></span></p>
  
  <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';">docx4j started with</span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';white-space:pre-wrap;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri';">ECMA-376 1st Edition.</span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">  Where appropriate later versions of the schemas are used.  docx4j 3.0 uses MathML 2ed, PresentationML 2ed, and SpreadsheemML 4ed transitional.</span></span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Docx4j can open documents which contain Word 2010, 2013</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> specific </span><span class="" style="font-family: 'Calibri';">content.</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">  The key extensions are supported.  For other stuff</span><span class="" style="font-family: 'Calibri';">, for example,  &lt;w14:glow w14:rad="101600"&gt;  it will look for and try to use mc:AlternateContent contained in the document.</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">  If you use docx4j to save the document, the w14:glow won’t be there any more (ie the docx will effectively be a Word 2007 docx).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Architecture</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Docx4j has 3 layers:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">1. <span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';">org.docx4j.openpackaging</span><br /><br /><span style="font-family: 'Calibri';">OpenPackaging handles things at the O</span><span style="font-family: 'Calibri';">pen Packaging Conventions level.</span><span style="font-family: 'Calibri';white-space:pre-wrap;"> </span><br /><br /><span style="font-family: 'Calibri';">It includes objects corresponding to each Office file type</span><span style="font-family: 'Calibri';">:</span></p>
  
  <p class="ListParagraph Normal DocDefaults "> </p>
  
  <table class="TableGrid TableNormal " id="docx4j_tbl_0" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 19mm;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 5.89in;"><colgroup><col style="width: 21.73%;" /><col style="width: 78.27%;" /></colgroup><tbody><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0in;"><span class="" style="font-family: 'Calibri';">docx</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0in;"><span class="DefaultParagraphFont " style="font-family: 'Calibri';">org.docx4j.openpackaging.packages.</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri';">WordprocessingMLPackage</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0in;"><span class="" style="font-family: 'Calibri';">pptx</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0in;"><span class="" style="font-family: 'Calibri';">org.docx4j.openpackaging.packages.</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri';">PresentationMLPackage</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0in;"><span class="" style="font-family: 'Calibri';">xlsx</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0in;"><span class="" style="font-family: 'Calibri';">org.docx4j.openpackaging.packages.</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri';">SpreadsheetMLPackage</span></p></td></tr></tbody></table>
  
  <p class="ListParagraph Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">and is responsible for unzipping the file into a set of objects inheriting from Part;  </span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';">openpackaging</span><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">also includes functionalitiy </span><span class="" style="font-family: 'Calibri';">allowing parts to be added/deleted; saving the docx/pptx/xlsx etc</span><br /><span class="" style="font-family: 'Calibri';" /><br /><span class="" style="font-family: 'Calibri';" /><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">This layer is based originally on OpenXML4J (which is also used by Apache POI). </span><br /><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">2. <span style="font-family: 'Calibri';white-space:pre-wrap;">Parts are generally subclasses of </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;;font-family: 'Consolas';">org</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';">.docx4j.</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;;font-family: 'Consolas';">openpackaging</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';">.parts.JaxbXmlPart</span><br /><br /><span style="font-family: 'Calibri';white-space:pre-wrap;">This (the </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;;font-family: 'Calibri';">jaxb</span><span class="DefaultParagraphFont " style="font-weight: bold;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> content tree</span></span><span style="font-family: 'Calibri';">) is the second level of the three layered model.</span><span style="font-family: 'Calibri';white-space:pre-wrap;">   </span><span style="font-family: 'Calibri';white-space:pre-wrap;">To explore these first two layers for a given document, </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">upload it to the PartsList webapp</span></a><span style="font-family: 'Calibri';">.</span><br /><br /><span style="font-family: 'Calibri';white-space:pre-wrap;">Parts are arranged in a tree.  If a part has descendants, it will have a </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';">org.docx4j.openpackaging.parts.relationships.RelationshipsPart</span><span style="font-family: 'Consolas';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';white-space:pre-wrap;">which identifies those descendant parts.  </span><br /><br /><span style="font-family: 'Calibri';">A JaxbXmlPart has a content tree:</span><br /><br /><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   <span class="" style="font-family: 'Consolas';">public Object getJaxbElement() {</span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   <span class="" style="font-family: 'Consolas';">return jaxbElement;</span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   <span class="" style="font-family: 'Consolas';">}</span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   <span class="" style="font-family: 'Consolas';">public void setJaxbElement(Object jaxbElement) {</span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   <span class="" style="font-family: 'Consolas';">this.jaxbElement = jaxbElement;</span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   <span class="" style="font-family: 'Consolas';">}</span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span></p>
  
  <p class="ListParagraph Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Most parts (including MainDocumentPart, styles, headers/footers, comments, </span><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">endnotes</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">/footnotes) use </span><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/wml"><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';">org.docx4j.wml</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">(WordprocessingML); </span><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">wml</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> references </span><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/wml"><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';">org.docx4j.dml</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';">(DrawingML) as necessary.</span><br /><span class="" style="font-family: 'Calibri';" /><br /><span class="" style="font-family: 'Calibri';">These classes were generated from the Open XML schemas</span><br /><span class="" style="font-family: 'Calibri';" /></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">3. <span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';">org.docx4j.model</span><span class="DefaultParagraphFont " style="font-weight: bold;"><br /></span><span class="DefaultParagraphFont " style="font-weight: bold;"><br /></span><span style="font-family: 'Calibri';white-space:pre-wrap;">This package builds on the lower two layers to provide extra functionality, and is being progressively further developed.    </span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';white-space:pre-wrap;">Jaxb: marshalling and unmarshalling </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Docx4j contains a class representing each part.  For example, there is a </span><span class="DefaultParagraphFont " style="font-family: 'Consolas';">MainDocumentPart</span><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">class.  XML parts inherit from </span><span class="DefaultParagraphFont " style="font-family: 'Consolas';">JaxbXmlPart</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">, which contains a member called </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';">jaxbElement</span><span class="" style="font-family: 'Calibri';">.  When you want to work with the contents of a part, you work with its jaxbElement</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> by using the </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';">get|setContents</span><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">method</span><span class="" style="font-family: 'Calibri';">.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">When you open a docx document using docx4j, docx4j automatically </span><span class="DefaultParagraphFont " style="font-weight: bold;font-style: italic;;font-family: 'Calibri';">unmarshals</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> the contents of each XML part to a strongly-type Java object tree (the jaxbElement).  Actually, docx4j 3.0 is lazy;  it only does this when first needed.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Similarly, if/when you tell docx4j to save these Java objects as a docx, docx4j automatically </span><span class="DefaultParagraphFont " style="font-weight: bold;font-style: italic;;font-family: 'Calibri';">marshals</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> the jaxbElement in each Part.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Sometimes you will want to marshal or unmarshal things yourself.  The class </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.jaxb.Context</span><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">defines all t</span><span class="" style="font-family: 'Calibri';">he JAXBContexts used in docx4j.  Here is representative (non-exhaustive) content:</span></p>
  
  <table class="TableGrid TableNormal " id="docx4j_tbl_1" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 0.76in;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 4.94in;"><colgroup><col style="width: 40.51%;" /><col style="width: 59.49%;" /></colgroup><tbody><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Consolas';">Jc</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.wml</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;"><br /><span class="" style="font-family: 'Consolas';">org.docx4j.dml</span><br /><span class="" style="font-family: 'Consolas';">org.docx4j.dml.picture</span><br /><span class="" style="font-family: 'Consolas';">org.docx4j.dml.wordprocessingDrawing</span><br /><span class="" style="font-family: 'Consolas';">org.docx4j.vml</span><br /><span class="" style="font-family: 'Consolas';">org.docx4j.vml.officedrawing</span><br /><span class="" style="font-family: 'Consolas';">org.docx4j.math</span></span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">jcThemePart</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.dml</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">jcDocPropsCore</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.docProps.core</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.docProps.core.dc.elements</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.docProps.core.dc.terms</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">jcDocPropsCustom</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.docProps.custom</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">jcDocPropsExtended</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.docProps.extended</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">jcXmlPackage</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.xmlPackage</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">jcRelationships</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.relationships</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">jcCustomXmlProperties</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.customXmlProperties</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">jcContentTypes</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.openpackaging.contenttype</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">jcPML</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.pml</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;"><br /><span class="" style="font-family: 'Consolas';">org.docx4j.dml</span><br /><span class="" style="font-family: 'Consolas';">org.docx4j.dml.picture</span></span></p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #FFFF00; border-style:solid; border-width:1px;background-color: #FFFF00;"><span class="DefaultParagraphFont " style=""><span class="" style="font-family: 'Calibri';">You’ll find XmlUtils.marshalToString very useful as you put your code together.  With this, you can easily output the content of a JAXB object, to see what XML it represents.</span></span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Parts List</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">To get a better understanding of how docx4j works – and the structure of a docx document – you can run the PartsList sample on a docx (or a pptx or xlsx).  If you do, it will list the hierarchy of parts used in that package.  It will tell you which class is used to represent each part, and where that part is a JaxbXmlPart, it will also tell you what class the </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">jaxbElement </span><span class="" style="font-family: 'Calibri';">is.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">So it’s a bit like unzipping the docx/pptx/xlsx file, but it tells you what Java objects are being used for each part.</span></p>
  
  <table class="TableGrid TableNormal " id="docx4j_tbl_2" style="background-color: #FFFF00;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 0in;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 6.65in;"><colgroup><col style="width: 100%;" /></colgroup><tbody><tr><td style="background-color: #FFFF00;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">A more fully featured tool is </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">the PartsList online webapp</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /><span class="" style="font-family: 'Calibri';">.  With this, you can:</span></p>
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0.53in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">browse through the package, </span></p>
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0.53in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">look up what elements mean in the spec, and </span></p>
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0.53in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">generate code.</span></p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">You can run PartsList locally</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> from a command line:</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.5in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Courier New';">java -cp docx4j-3.0.1.jar:log4j-1.2.17.jar;</span><span class="DefaultParagraphFont " style="color: #222222;background-color: #FFFFFF;font-size: 6.5pt;;font-family: 'Courier New';">slf4j-api-1.7.5.jar;slf4j-log4j12-1.7.5.jar</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Courier New';white-space:pre-wrap;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;"><br /><span class="" style="font-family: 'Courier New';">org.docx4j.samples.</span></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Courier New';white-space:pre-wrap;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Courier New';">PartsList [input.docx]</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">though I always find it easier to run it from my IDE.   Example</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> output: </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">Part /_rels/.rels [org.docx4j.openpackaging.parts.relationships.RelationshipsPart]</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">  containing JaxbElement:org.docx4j.relationships.Relationships</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">Part /docProps/app.xml [org.docx4j.openpackaging.parts.DocPropsExtendedPart]  </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">  containing JaxbElement:org.docx4j.docProps.extended.Properties</span></span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">Part /docProps/core.xml [org.docx4j.openpackaging.parts.DocPropsCorePart]  </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">  containing JaxbElement:org.docx4j.docProps.core.CoreProperties</span></span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">Part </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">/word/document.xml</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> [org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart]  </span><br /><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">  containing JaxbElement:org.docx4j.wml.Document</span></span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">Part /word/settings.xml [</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 7.0pt;;font-family: 'Consolas';">org.docx4j.openpackaging.parts.WordprocessingML</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">.DocumentSettingsPart]  </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">  containing JaxbElement:org.docx4j.wml.CTSettings</span></span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">Part /word/styles.xml [</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 7.0pt;;font-family: 'Consolas';">org.docx4j.openpackaging.parts.WordprocessingML</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">.StyleDefinitionsPart]  </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">  containing JaxbElement:org.docx4j.wml.Styles</span></span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">Part /word/media/image1.jpeg [</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 7.0pt;;font-family: 'Consolas';">org.docx4j.openpackaging.parts.WordprocessingML</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">.ImageJpegPart] </span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">docx4j includes convenience methods to make it easy to access commonly used parts. These include,</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">on the package:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> MainDocumentPart getMainDocumentPart() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> DocPropsCorePart getDocPropsCorePart() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> DocPropsExtendedPart getDocPropsExtendedPart() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> DocPropsCustomPart getDocPropsCustomPart() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">on the document part:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> StyleDefinitionsPart getStyleDefinitionsPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> NumberingDefinitionsPart getNumberingDefinitionsPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> ThemePart getThemePart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> FontTablePart getFontTablePart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> CommentsPart getCommentsPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> EndnotesPart getEndNotesPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> FootnotesPart getFootnotesPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> DocumentSettingsPart getDocumentSettingsPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> WebSettingsPart getWebSettingsPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">If a part points to any other parts, it will have a relationships part listing these other parts. </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Courier New';">RelationshipsPart rp = part.getRelationshipsPart();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">You can access those, and from there, get the part you want:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">for</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> ( Relationship r : rp.getRelationships().getRelationship() ) {</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="color: #0000C0;font-style: italic;font-size: 8.0pt;;font-family: 'Courier New';">log</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Courier New';">.info(</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Courier New';">"\nFor Relationship Id="</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> + r.getId() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">            <span class="" style="font-family: 'Courier New';white-space:pre-wrap;">+ </span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Courier New';">" Source is "</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> + rp.getSourceP().getPartName() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">            <span class="" style="font-family: 'Courier New';white-space:pre-wrap;">+ </span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Courier New';">", Target is "</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> + r.getTarget() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">            <span class="" style="font-family: 'Courier New';white-space:pre-wrap;">+ </span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Courier New';">" type "</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> + r.getType() + </span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Courier New';">"\n"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Courier New';">);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Courier New';">Part part = rp.getPart(r);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Courier New';">}</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         </span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">That gives access to just the parts this part points to.</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Courier New';white-space:pre-wrap;">RelationshipsPart </span><span class="" style="font-family: 'Calibri';">contains</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> various useful utility methods, for example</span><span class="" style="font-family: 'Calibri';">:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;;font-family: 'Consolas';">/** Gets a loaded Part by its id */</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Consolas';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> Part </span></span><span class="DefaultParagraphFont " style="color: #000000;background-color: #D3D3D3;font-size: 10.0pt;;font-family: 'Consolas';">getPart</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Consolas';white-space:pre-wrap;">(String id) </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Consolas';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> Part getPart(Relationship r ) {</span></span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The  </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';white-space:pre-wrap;">RelationshipsPart </span><span class="" style="font-family: 'Calibri';">is the key player when it comes to adding/removing images and other parts from your document.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">There is also a list of </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri';">all</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> parts, in the package object:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Courier New';">Parts parts = wordMLPackage.getParts();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">The Parts object encapsulates a map of parts, keyed by PartName, but you generally shouldn’t add/remove things here directly!</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">To add a part, see the section </span><a href="#_Ref275255216"><span style="font-family: 'Calibri';">Adding a Part</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> below.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">MainDocumentPart</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">The text of the document is to be found in the main document part.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Its XML will look something like:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&lt;</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:document</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Consolas';">xmlns:w</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">http://schemas.openxmlformats.org/wordprocessingml/2006/main</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> &gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">  &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:body</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:p</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> &gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">      &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:pPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">        &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:pStyle</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Consolas';">w:val</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">Heading1</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">/&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">      &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:pPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">      &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:r</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">        &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:t</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">Hello World</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:t</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">      &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:r</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">    &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:p</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">    :</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:sectPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> &gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">      &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:pgSz</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Consolas';">w:w</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">12240</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Consolas';">w:h</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">15840</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">/&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">      &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:pgMar</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Consolas';">w:top</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">1440</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Consolas';">w:right</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">1440</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Consolas';">w:bottom</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">1440</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Consolas';">w:left</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">1440</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Consolas';">w:header</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">708</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Consolas';">w:footer</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">708</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Consolas';">w:gutter</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">0</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">/&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">    &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:sectPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">  &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:body</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Consolas';">w:document</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">Given:</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">WordprocessingMLPackage wordMLPackage</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">you can access:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   <span class="" style="font-family: 'Courier New';">MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">Classically, you'd then do:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   <span class="" style="font-family: 'Courier New';white-space:pre-wrap;">org.docx4j.wml.Document wmlDocumentEl </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      <span class="" style="font-family: 'Courier New';">= (org.docx4j.wml.Document) documentPart.getJaxbElement();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   <span class="" style="font-family: 'Courier New';">Body body = wmlDocumentEl.getBody();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">But </span><span class="" style="font-family: 'Calibri';">you can skip some of that with:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Calibri';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;;font-family: 'Courier New';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;">     * Convenience method to getJaxbElement().getBody().getContent()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;">     */</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> List&lt;Object&gt; getContent() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">A paragraph is org.docx4j.wml.P; a paragraph is basically made up of runs of text.</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #646464;font-size: 10.0pt;;font-family: 'Courier New';">@</span><span class="DefaultParagraphFont " style="color: #646464;font-size: 10.0pt;text-decoration: underline;;font-family: 'Courier New';">XmlRootElement</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';white-space:pre-wrap;">(name = </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 10.0pt;;font-family: 'Courier New';">"p"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';">)</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Courier New';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> P </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Courier New';">implements</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> Child, ContentAccessor</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';">ContentAccessor</span><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">interface is simply:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;;font-family: 'Courier New';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> * </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F9FBF;font-size: 10.0pt;;font-family: 'Courier New';">@since</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> 2.7</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> */</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Courier New';">interface</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #000000;background-color: #D3D3D3;font-size: 10.0pt;;font-family: 'Courier New';">ContentAccessor</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> {</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> List&lt;Object&gt; getContent();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';">}</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">it is implemented by a number of objects, including:</span></p>
  
  <table class="TableGrid TableNormal " id="docx4j_tbl_3" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 0.86in;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 132mm;"><colgroup><col style="width: 33.97%;" /><col style="width: 24.53%;" /><col style="width: 41.5%;" /></colgroup><tbody><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Body</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">w:body</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">document body</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">P</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">w:p</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">paragraph</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">R</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">w:r</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">run</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Tbl</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Tr</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Tc</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">w:tbl</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">w:tr</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">w:tc</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">table</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">table row</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">table cell</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">SdtBlock</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">SdtRun</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">CTSdtRow</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">CTSdtCell</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">w:sdt</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">w:sdt</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">w:sdt</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">w:sdt</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">content controls; see the method</span><span class="DefaultParagraphFont " style="color: #000000;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Courier New';white-space:pre-wrap;">getSdtContent()</span></span></p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">As well as </span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-bottom: 0.07in;line-height: 100%;">•  <span style="font-family: 'Calibri';">Hdr, Ftr</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #FFFF00; border-style:solid; border-width:1px;background-color: #FFFF00;"><span class="" style="font-family: 'Calibri';">Content is generally stored in a plain old Java List.  So there are familiar methods for inserting content at the end of the list, or other location in it.</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">Read on for how to add text etc.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Samples</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The package org.docx4j.samples contains examples of how to do things with docx4j.  </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">Most samples are not included in the docx4j jar.  You can find them at:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">(mostly) </span><span style="font-family: 'Calibri';">https://github.com/plutext/docx4j/tree/master/src/samples/docx4j/org/docx4j/samples</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">(the 3 which are included) </span><span style="font-family: 'Calibri';">https://github.com/plutext/docx4j/tree/master/src/main/java/org/docx4j/samples</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">The docx4j samples include:</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">Basics</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">CreateWordprocessingMLDocument</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">DisplayMainDocumentPartXml</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">OpenAndSaveRoundTripTest</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">PartsList</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">Navigating the document body</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">OpenMainDocumentAndTraverse</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">XPathQuery</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">Output/Transformation</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">ConvertOutHtml</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">ConvertOutPDF</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">Import (X)HTML</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">AltChunkXHTMLRoundTrip</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">AltChunkAddOfTypeHtml</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">ConvertIn</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">XHTMLDocument</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">ConvertInXHTML</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">Fragment</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';white-space:pre-wrap;">Image handling </span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">Image</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">Add</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">Image</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">ConvertEmbedded</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">ToLinked</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">Part Handling</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">PartCopy</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">PartLoadFromFileSystem</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">PartsList</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">PartsStrip</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">Document generation/document assembly using content controls</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">ContentControlsAddCustomXmlDataStoragePart</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">ContentControlsXmlEdit</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">ContentControlsApplyBinding</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">s</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">ContentControlBindingExtensions</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">ContentControlsPartsInfo</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">AltChunkAddOfTypeDocx</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">VariableReplace (not recommended)</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">Specific docx features</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">BookmarkAdd</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">CommentsSample</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">HeaderFooterCreate</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">HeaderFooterList</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">HyperlinkTest</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">NumberingRestart</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">SubDocument</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">TableOfContentsAdd</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">TemplateAttach (attach your.dotx)</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">Miscellaneous</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">CompareDocuments</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">DocProps</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">Filter</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> (remove proof errors, w:rsid)</span></span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">MergeDocx</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">UnmarshallFromTemplate</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';white-space:pre-wrap;">Flat OPC XML </span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">ConvertOutFlatOpenPackage</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri';">ConvertInFlatOpenPackage</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Creating a new docx</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">To create a new docx:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';">// Create the package</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';">// Save it</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Consolas';">wordMLPackage.save(new java.io.File("helloworld.docx") );</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">That's it.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">There’s a sample you can try locally from a command line:</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.5in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Courier New';">java -cp docx4j-3.0.1.jar:log4j-1.2.17.jar;</span><span class="DefaultParagraphFont " style="color: #222222;background-color: #FFFFFF;font-size: 6.5pt;;font-family: 'Courier New';">slf4j-api-1.7.5.jar;slf4j-log4j12-1.7.5.jar</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Courier New';white-space:pre-wrap;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;"><br /><span class="" style="font-family: 'Courier New';">org.docx4j.samples.</span></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Courier New';white-space:pre-wrap;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Courier New';">CreateDocx [input.docx]</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">createPackage() </span><span class="" style="font-family: 'Calibri';">is a convenience method, which does:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';">// Create the package</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">WordprocessingMLPackage wordMLPackage = new WordprocessingMLPackage();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';">// Create the main document part (word/document.xml)</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Consolas';">MainDocumentPart wordDocumentPart = new MainDocumentPart();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';">// Create main document part content</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">ObjectFactory factory = Context.getWmlObjectFactory();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.wml.Body body = factory .createBody();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.wml.Document wmlDocumentEl = factory .createDocument();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">wmlDocumentEl.setBody(body);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';">// Put the content in the part</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">wordDocumentPart.setJaxbElement(wmlDocumentEl);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">            </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';">// Add the main document part to the package relationships</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';">// (creating it if necessary)</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">wmlPack.addTargetPart(wordDocumentPart);</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Ref273525601" /><span style="font-family: 'Cambria';">docx4j.properties</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Here is a sample docx4j.properties file:</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';"># Page size: use a value from org.docx4j.model.structure.PageSizePaper enum</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';"># eg A4, LETTER</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">docx4j.PageSize=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">LETTER</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';"># Page size: use a value from org.docx4j.model.structure.MarginsWellKnown enum</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">docx4j.PageMargins=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">NORMAL</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">docx4j.PageOrientationLandscape=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">false</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';"># Page size: use a value from org.pptx4j.model.SlideSizesWellKnown enum</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';"># eg A4, LETTER</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">pptx4j.PageSize=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">LETTER</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">pptx4j.PageOrientationLandscape=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">false</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';"># These will be injected into docProps/app.xml</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';"># if App.Write=true</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">docx4j.App.write=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">true</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">docx4j.Application=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">docx4j</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">docx4j.AppVersion=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">2.7</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';"># of the form XX.YYYY where X and Y represent numerical values</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';"># These will be injected into docProps/core.xml</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">docx4j.dc.write=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">true</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">docx4j.dc.creator.value=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">docx4j</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">docx4j.dc.lastModifiedBy.value=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">docx4j</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">#</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">#docx4j.McPreprocessor=true</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';"># If you haven't configured log4j yourself</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';"># docx4j will autoconfigure it.  Set this to true to disable that</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">docx4j.Log4j.Configurator.disabled=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">false</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">The page size, margin &amp; orientation values are used when new documents are created; naturally they don't affect an existing document you open with docx4j.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">If no docx4j.properties file is found on your class path, docx4j has hard coded defaults.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Adding a paragraph of text</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">MainDocumentPart </span><span class="" style="font-family: 'Calibri';">contains a method:</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">public </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.wml.P addStyledParagraphOfText(String styleId, String text)</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">You can use that method to add a paragraph using the specified style.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">The XML we are looking to create will be something like:</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&lt;</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Consolas';white-space:pre-wrap;">w:p </span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;;font-family: 'Consolas';"> </span><span class="xmlmarkupattributename DefaultParagraphFont " style="color: #FF0000;font-size: 8.5pt;;font-family: 'Consolas';">xmlns:w</span><span class="xmlmarkupattributevalue DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">="http://schemas.openxmlformats.org/wordprocessingml/2006/main"</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><span class="" style="font-family: 'Consolas';">    </span></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&lt;</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Consolas';">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><span class="" style="font-family: 'Consolas';">        </span></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&lt;</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Consolas';">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&gt;</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;;font-family: 'Consolas';">Hello world</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&lt;/</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Consolas';">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><span class="" style="font-family: 'Consolas';">    </span></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&lt;/</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Consolas';">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&lt;/</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Consolas';">w:p</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">addStyledParagraphOfText </span><span class="" style="font-family: 'Calibri';">builds the object structure “the JAXB way”, and adds it to the document.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">It is based on:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Consolas';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> org.docx4j.wml.P createParagraphOfText(String simpleText) {</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      <span class="" style="font-family: 'Consolas';">org.docx4j.wml.ObjectFactory factory = Context.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 10.0pt;;font-family: 'Consolas';">getWmlObjectFactory</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Consolas';">();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      <span class="" style="font-family: 'Consolas';">org.docx4j.wml.P  para = factory.createP();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Consolas';">if</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> (simpleText!=</span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Consolas';">null</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Consolas';">) {</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">         <span class="" style="font-family: 'Consolas';">org.docx4j.wml.Text  t = factory.createText();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">         <span class="" style="font-family: 'Consolas';">t.setValue(simpleText);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">         <span class="" style="font-family: 'Consolas';">org.docx4j.wml.R  run = factory.createR();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">         <span class="" style="font-family: 'Consolas';">run.</span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 10.0pt;;font-family: 'Consolas';">getContent</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Consolas';white-space:pre-wrap;">().add(t); </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 10.0pt;;font-family: 'Consolas';">// ContentAccessor</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 10.0pt;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">         </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">         <span class="" style="font-family: 'Consolas';">para.</span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 10.0pt;;font-family: 'Consolas';">getContent</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Consolas';white-space:pre-wrap;">().add(run); </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 10.0pt;;font-family: 'Consolas';">// ContentAccessor</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      <span class="" style="font-family: 'Consolas';">}</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Consolas';">return</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> para;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   <span class="" style="font-family: 'Consolas';">}</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 4mm;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Notice that the paragraph, the run, and indeed the Body, all implement the </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';">ContentAccessor</span><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">interface:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;;font-family: 'Courier New';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> * </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F9FBF;font-size: 10.0pt;;font-family: 'Courier New';">@since</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> 2.7</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> */</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Courier New';">interface</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #000000;background-color: #D3D3D3;font-size: 10.0pt;;font-family: 'Courier New';">ContentAccessor</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> {</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Courier New';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> List&lt;Object&gt; getContent();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Courier New';">}</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The add method adds the content at the end of the document.  If you want to insert it somewhere else, </span><span class="" style="font-family: 'Calibri';">you could use something like:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> org.docx4j.wml.P addParaAtIndex(MainDocumentPart mdp,</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">String simpleText, </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">int</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> index) {</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Consolas';">org.docx4j.wml.ObjectFactory factory = Context.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: 'Consolas';">getWmlObjectFactory</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Consolas';">org.docx4j.wml.P para = factory.createP();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">if</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> (simpleText != </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">null</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">) {</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Consolas';">org.docx4j.wml.Text t = factory.createText();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Consolas';">t.setValue(simpleText);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Consolas';">org.docx4j.wml.R run = factory.createR();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Consolas';">run.getContent().add(t);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Consolas';">para.getContent().add(run);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Consolas';">}</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Consolas';">mdp.getContent().add(index, para);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">return</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> para;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Consolas';">}</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">Alternatively, you can create the paragraph by marshalling XML:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';">// Assuming String xml contains the XML above</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.wml.P  para = XmlUtils.unmarshalString(xml);</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">For this to work, you need to ensure that all namespaces are declared properly in the string.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">See further below for adding images, and tables.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Ref273526076" /><span class="DefaultParagraphFont " style="font-family: 'Cambria';">General strategy/approach for creating stuff</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">The first thing you need to know is what the XML you are trying to create looks like.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">To figure this out, start with a docx that contains the construct (create it in Word if necessary).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Now look at its XML. Choices:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">You can unzip it to do this </span><span style="font-family: 'Calibri';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';white-space:pre-wrap;">blagh</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">upload it to </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;">the PartsList </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;">online </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">webapp</span></a><span style="font-family: 'Calibri';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';white-space:pre-wrap;">(which can also generate code for you)</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">save it as Flat OPC XML from Word (or use the </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Courier New';">ExportInPackageFormat</span><span style="font-family: 'Courier New';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';white-space:pre-wrap;">sample),  so you have just a single XML file which you don't need to unzip</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">you can use the </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Courier New';white-space:pre-wrap;">DisplayMainDocumentPartXml </span><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">to get it</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">you can open it with docx4all, and look at the source view</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">on Windows, if you have Visual Studio 2010, you can drag the docx onto it</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span class="DefaultParagraphFont " style="color: #000000;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">if you use Google’s Chrome web browser, try </span></span><a href="https://chrome.google.com/webstore/detail/ooxml-viewer/bjmmjfdegplhkefakjkccocjanekbapn"><span class="Hyperlink DefaultParagraphFont " style="font-weight: bold;color: #0066DD;background-color: #F7F7F7;font-size: 9.0pt;;font-family: 'Arial';">OOXML Viewer for Chrome</span></a><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Now you are ready to create this XML using JAXB.  There are 2 basic ways.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">The classic JAXB way is to use the ObjectFactory's .createX methods.  For example:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">       </span><span class="" style="font-family: 'Courier New';white-space:pre-wrap;">ObjectFactory factory = Context.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 9.0pt;;font-family: 'Courier New';">getWmlObjectFactory</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Courier New';white-space:pre-wrap;">(); </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;">       P p = factory.createP();</span>   </span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The challenge with this is to know what object it is you are trying to create.  To find this out, the easiest way by far is to use </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;">the PartsList </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;">online </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">webapp</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">.  Alternatively, you could run </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Courier New';white-space:pre-wrap;">OpenMainDocumentAndTraverse </span><span class="" style="font-family: 'Calibri';">on your document, or use Eclipse to search the relevant schema (in /xsd) or source code.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Here are the names for some common objects:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <table class="TableGrid TableNormal " id="docx4j_tbl_4" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 0.37in;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 5.12in;"><colgroup><col style="width: 19.22%;" /><col style="width: 17.31%;" /><col style="width: 32.36%;" /><col style="width: 31.11%;" /></colgroup><tbody><tr><td style="background-color: #D9D9D9;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">Object</span></p></td><td style="background-color: #D9D9D9;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">XML element</span></p></td><td style="background-color: #D9D9D9;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">docx4j class</span></p></td><td style="background-color: #D9D9D9;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">Factory method</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">Document body</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">w:body</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">org.docx4j.wml.Body</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">factory.createBody();</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">Paragraph</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">w:p</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">org.docx4j.wml.P</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">factory.createP()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">Paragraph props</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">w:pPr</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">org.docx4j.wml.PPr</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">factory.createPPr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">Run</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">w:r</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">org.docx4j.wml.R</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">factory.createR()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">Run props</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">w:rPr</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">org.docx4j.wml.RPr</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">factory.createRPr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">Text</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">w:t</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">org.docx4j.wml.Text</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">factory.createText()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">Table</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">w:tbl</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">org.docx4j.wml.Tbl</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">factory.createTbl()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">Table row</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">w:tr</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">org.docx4j.wml.Tr</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">factory.createTr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">Table cell</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">w:tc</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">org.docx4j.wml.Tc</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">factory.createTc()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">Drawing</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">w:drawing</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">org.docx4j.wml.Drawing</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">factory.createDrawing()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">Page break</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">w:br</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">org.docx4j.wml.Br</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">factory.createBr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">Footnote </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><br /><span class="" style="font-family: 'Calibri';">or endnote ref</span></span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">?</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">org.docx4j.wml.CTFtnEdnRef</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri';">factory.createCTFtnEdnRef()</span></p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">An easier way to create stuff </span><span class="" style="font-family: 'Calibri';">may be to just unmarshal the  XML (eg a String representing a paragraph to be inserted into the document).</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">For example, given:</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&lt;</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Consolas';white-space:pre-wrap;">w:p </span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;;font-family: 'Consolas';"> </span><span class="xmlmarkupattributename DefaultParagraphFont " style="color: #FF0000;font-size: 8.5pt;;font-family: 'Consolas';">xmlns:w</span><span class="xmlmarkupattributevalue DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">="http://schemas.openxmlformats.org/wordprocessingml/2006/main"</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><span class="" style="font-family: 'Consolas';">    </span></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&lt;</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Consolas';">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><span class="" style="font-family: 'Consolas';">        </span></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&lt;</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Consolas';">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&gt;</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;;font-family: 'Consolas';">Hello world</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&lt;/</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Consolas';">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><span class="" style="font-family: 'Consolas';">    </span></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&lt;/</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Consolas';">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&lt;/</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Consolas';">w:p</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">you can simply:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';">// Assuming String xml contains the XML above</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.wml.P  para = XmlUtils.unmarshalString(xml);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #FFFF00; border-style:solid; border-width:1px;background-color: #FFFF00;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;">PartsList </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;">online </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">webapp</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> can generate appropriate code for you, using both of these approaches.  It also links to the Open XML spec documentation for the element.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">If you need to be explicit about the type, you can use:</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">public static </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">Object unmarshalString(String str, JAXBContext jc, Class declaredType)</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Formatting Properties</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Usually you format the appearance of things via an object’s properties element:</span></p>
  
  <table class="TableGrid TableNormal " id="docx4j_tbl_5" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 0.47in;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 101mm;"><colgroup><col style="width: 44.09%;" /><col style="width: 55.91%;" /></colgroup><tbody><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Object</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Method</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Paragraph</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">P.getPPr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Run</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">R.getRPr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Table</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Tbl.getTblPr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Table row</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Tr.getTrPr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Table cell</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Tc.getTcPr()</span></p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">In a docx, the appearance of text is basically determined by the style in the styles part which applies to it (styles can inherit from other styles), plus any direct formatting.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Docx4j contains code for working out the effective formatting, which is used in its PDF output.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">In XHTML import, docx4j converts CSS into formatting properties.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Creating and adding a table</span></p>
  
  <p class="Normal DocDefaults "><a href="http://dev.plutext.org/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/model/table/TblFactory.java"><span style="font-family: 'Calibri';">org.docx4j.model.table.TblFactory</span></a><span style="font-family: 'Calibri';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';white-space:pre-wrap;">provides an easy way to create a simple table. For an example of its use, see the </span><a href="http://dev.plutext.org/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/samples/CreateWordprocessingMLDocument.java"><span style="font-family: 'Calibri';">CreateWordprocessingMLDocument sample</span></a><span style="font-family: 'Calibri';">.</span><span style="font-family: 'Calibri';white-space:pre-wrap;">  </span><span style="font-family: 'Calibri';white-space:pre-wrap;">If you want to add </span><span style="font-family: 'Calibri';">content</span><span style="font-family: 'Calibri';white-space:pre-wrap;">, see </span><a href="#_Ref273526076"><span class="DefaultParagraphFont " style="font-weight: bold;font-style: italic;;font-family: 'Calibri';">General strategy/approach for creating stuff</span></a><span style="font-family: 'Calibri';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';white-space:pre-wrap;">above.</span><span style="font-family: 'Calibri';white-space:pre-wrap;">  </span><span style="font-family: 'Calibri';">If you want format your table (make it prettier), see Formatting Properties immediately above.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Or you can use the </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;">PartsList </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;">online </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">webapp</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> to generate the code.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">If you are looking to fill table rows with data, consider OpenDoPE content control data binding (in which you “repeat” a table row).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';white-space:pre-wrap;">Selecting your insertion/editing point; </span><span class="DefaultParagraphFont " style=""><br /><span class="" style="font-family: 'Cambria';">accessing JAXB nodes via XPath</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">Sometimes, XPath is a succinct way to select the things you need to change.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">You</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> can use XPath to select JAXB nodes:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Consolas';">MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">String xpath = </span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">"//w:p"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">List&lt;Object&gt; list = documentPart.getJAXBNodesViaXPath(xpath, </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">false</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">);</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">These JAXB nodes are live, in the sense that if you change them, your document changes.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">There are a few limitations however</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> in the JAXB reference implementation: </span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">the xpath expressions are evaluated against the XML document as it was when first opened in docx4j.  You can update the associated XML document once only, by passing true into </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">getJAXBNodesViaXPath</span><span style="font-family: 'Calibri';">. Updating it again (with current JAXB 2.1.x or 2.2.x) will cause an error.</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span style="font-family: 'Calibri';">For some objects,</span><span style="font-family: 'Calibri';white-space:pre-wrap;">JAXB can</span><span style="font-family: 'Calibri';white-space:pre-wrap;">’</span><span style="font-family: 'Calibri';white-space:pre-wrap;">t get </span><span style="font-family: 'Calibri';">parent (with getParent)</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;">•  <span style="font-family: 'Calibri';">For some document, JAXB can</span><span style="font-family: 'Calibri';">’</span><span style="font-family: 'Calibri';">t set up the XPath</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">If these limitations are causing you problems, try using MOXy as your JAXB implementation, or see Traversing immediately </span><span class="" style="font-family: 'Calibri';">below for a different approach.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Traversing a document</span></p>
  
  <p class="Normal DocDefaults "><a href="https://github.com/plutext/docx4j/blob/master/src/main/java/org/docx4j/samples/OpenMainDocumentAndTraverse.java"><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri';">OpenMainDocumentAndTraverse.java</span></a><span style="font-family: 'Calibri';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';white-space:pre-wrap;">in the samples directory shows you how to traverse the JAXB representation of a docx.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">This is an alternative to XSLT, which doesn't require marshalling</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> to a DOM document and </span><span class="" style="font-family: 'Calibri';">unmarshalling</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> again</span><span class="" style="font-family: 'Calibri';">.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The sample uses TraversalUtil, which is a general approach for traversing the JAXB object tree in the main document part.  It can also be applied to headers, footers etc.   TraversalUtil has an </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">interface</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> Callback, </span></span><span class="" style="font-family: 'Calibri';">which you use to specify how you want to traverse the nodes, and what you want to do to them.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">As noted earlier,</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> many objects (eg the document body, a paragraph, a run), have a List containing their content.  Traversal works by iterating over these lists. </span></p>
  
  <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #FFFF00; border-style:solid; border-width:1px;background-color: #FFFF00;"><span class="DefaultParagraphFont " style="background-color: #FFFF00;;font-family: 'Calibri';">Traversing is a very useful approach</span><span class="DefaultParagraphFont " style="background-color: #FFFF00;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> for finding and altering parts of the document.</span></span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">For example, it is used in docx4j 2.8.0, to provide a way of producing HTML output without using XSLT/Xalan.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The </span><a href="https://github.com/plutext/docx4j/tree/master/src/main/java/org/docx4j/finders"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">org.docx4j.finders</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> package contains classes which make it convenient to find various objects.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">It is often superior to using XPath (owing to the limitations in the JAXB reference implementation noted above).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Note also, in </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Consolas';">package</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> org.docx4j.utils:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;;font-family: 'Consolas';white-space:pre-wrap;">/** </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> * Use this if there is only a single object type (</span></span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;text-decoration: underline;;font-family: 'Consolas';">eg</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> just P's)</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> * you are interested in doing something with.</span></span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Consolas';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Consolas';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> SingleTraversalUtilVisitorCallback </span></span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">ImageConvertEmbeddedToLinked sample contains an example of the use of the above.</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;;font-family: 'Consolas';white-space:pre-wrap;">/** </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> * Use this if there is more than one object type (</span></span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;text-decoration: underline;;font-family: 'Consolas';">eg</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> Tables and Paragraphs)</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> * you are interested in doing something with during the traversal.</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Consolas';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Consolas';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> CompoundTraversalUtilVisitorCallback </span></span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Ref275255216" /><span style="font-family: 'Cambria';">Adding a Part</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">What if you wanted to add a new styles part? Here's how:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';">// Create a styles part</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">StyleDefinitionsPart stylesPart = </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">new </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">StyleDefinitionsPart();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';">// Populate it with default styles</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">stylesPart.unmarshalDefaultStyles();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';">// Add the styles part to the main document part relationships</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">wordDocumentPart.addTargetPart(stylesPart);</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">You'd take the same approach to add a header or footer.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">When you add a part this way, it is automatically added to the source part's relationships part.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">Generally, you'll also need to add a reference to the part (using its relationship id) to the Main Document Part.  This applies to images, headers and footers. (Comments, footnotes and endnotes are a bit different, in that what you add to the main document part are references to individual comments/footnotes/endnotes).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Importing XHTML</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">From docx4j 2.8.0, docx4j can convert XHTML content (paragraphs, tables, images) into native WordML, reproducing much of the formatting.</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">  If you are using this, </span><span class="" style="font-family: 'Calibri';">v3</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> is highly recommended.</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';">From v3, the XHTML Import functionality is now a</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';"> </span><a href="https://github.com/plutext/docx4j-ImportXHTML"><span class="Hyperlink DefaultParagraphFont " style="color: #B85B5A;font-size: 11.0pt;;font-family: 'Calibri';">separate project on GitHub</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';" /><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';">.</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';">The reason being that its main dependency – Flying Saucer - is licensed under LGPL v2.1 (as opposed to ASL v2, which docx4j’s other dependencies use).</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';">If you want this functionality, you have to add these jars to your classpath.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">See the samples at </span><a href="https://github.com/plutext/docx4j-ImportXHTML/tree/master/src/samples"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">https://github.com/plutext/docx4j-ImportXHTML/tree/master/src/samples</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">docx to (X)HTML</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">docx4j can convert a docx to HTML or XHTML.  </span><span class="" style="font-family: 'Calibri';">You will find the generated HTML is clean</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> (in comparison to the HTML Word produces)</span><span class="" style="font-family: 'Calibri';">.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">Docx4j’s HTML output is suitable for documents which contain paragraphs, tables and images.  It can’t handle more exotic features, such as equations, SmartArt, or WordArt (DrawingML or VML).</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">Elsewhere on the web, you’ll find XSLT which can convert docx to HTML.  That XSLT is very complex, since it has to derive effective formatting from the hierarchy.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">In contrast, in docx4j, that logic is implemented in Java.  Because of this, docx4j’s XSLT is simple (Java XSLT extension functions do the heavy lifting).</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">In docx4j, you can create output using XSLT, or by traversing the document in Java.</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">  The façade lets you specify which:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">//Prefer the exporter, that uses a </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">xsl</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> transformation</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Consolas';">Docx4J.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: 'Consolas';">toHTML</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">(htmlSettings, os, Docx4J.</span><span class="DefaultParagraphFont " style="color: #0000C0;font-style: italic;font-size: 8.0pt;;font-family: 'Consolas';">FLAG_EXPORT_PREFER_XSL</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">//Prefer the exporter, that doesn't use a </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">xsl</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> transformation (= uses a visitor)</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">//</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;">      <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">Docx4J.toHTML(htmlSettings, </span></span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">os</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">, Docx4J.FLAG_EXPORT_PREFER_NONXSL);</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">See the sample on GitHub at </span><a href="https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/ConvertOutHtml.java"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">src/samples/docx4j/org/docx4j/samples/ConvertOutHtml.java</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">If you have output logging enabled, anything which is not implemented will be obvious in the output document.  </span><span class="DefaultParagraphFont " style="font-weight: bold;font-style: italic;;font-family: 'Calibri';">If debug level logging is not switched on, unsupported elements will be silently dropped.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">docx to PDF</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">docx4j produces XSL FO, which can in turn be used to create a PDF.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">You can try it with the online demo, at </span><a href="http://webapp.docx4java.org/OnlineDemo/docx_to_pdf_fop.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">http://webapp.docx4java.org/OnlineDemo/docx_to_pdf_fop.html</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">Generally speaking, docx4j’s PDF output is suitable for documents which contain paragraphs, tables and images.  It can’t handle more exotic features, such as equations, SmartArt, or WordArt (DrawingML or VML).</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">At present, Apache FOP is integrated int</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">o docx4j for creating the PDF. </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">See the sample on GitHub at </span><a href="https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/ConvertOutPDF.java"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">src/samples/docx4j/org/docx4j/samples/ConvertOutPDF.java</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /><span class="" style="font-family: 'Calibri';">.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">If you have output logging enabled, anything which is not implemented will be obvious in the output document.  </span><span class="DefaultParagraphFont " style="font-weight: bold;font-style: italic;;font-family: 'Calibri';">If debug level logging is not switched on, unsupported elements will be silently dropped.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Fonts</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">When docx4j is used to create a PDF, it can only use fonts which are available to it.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">These fonts come from 2 sources:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">those installed on the computer</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">those embedded in the document</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Note that Word silently performs </span><span class="DefaultParagraphFont " style="font-weight: bold;font-style: italic;;font-family: 'Calibri';">font substitution</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">.  When you open an existing document in Word, and select text in a particular font, the actual font you see on the screen won't be the font reported in the ribbon if it is not installed on your computer or embedded in the document.  To see whether Word 2007 is substituting a font, go into Word Options &gt; Advanced &gt; Show Document Content and press the "Font Substitution" button.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Word's font substitution information is not available to docx4j.  As a developer, you 3 options:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">ensure the font is installed or embedded</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">tell docx4j which font to use instead, or</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">allow docx4j to fallback to a default font</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">To embed a font in a document, open it in Word on a computer which has the font installed (check no substitution is occuring), and go to Word Options &gt; Save &gt; Embed Fonts in File.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">If you want to tell docx4j to use a different font, you need to add a font mapping.  The FontMapper interface is used to do this.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">On a Windows computer, font names for installed fonts are mapped 1:1 to the corresponding physical fonts via the IdentityPlusMapper. </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">A font mapper contains Map&lt;String, PhysicalFont&gt;; to add a font mapping, as per the example in the </span><span class="" style="font-family: 'Calibri';">ConvertOutPDF</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> sample:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">// Set up font </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">mapper</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">Mapper fontMapper = </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">new</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> IdentityPlusMapper();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Consolas';">wordMLPackage.setFontMapper(fontMapper);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">// Example of mapping missing font Algerian to installed font Comic </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Sans</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> MS</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Consolas';">PhysicalFont font = PhysicalFonts.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: 'Consolas';">getPhysicalFonts</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">().get(</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">"Comic Sans MS"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Consolas';">fontMapper.getFontMappings().put(</span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">"Algerian"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">, font);</span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">You'll see the font names if you configure log4j debug level logging for </span><span class="DefaultParagraphFont " style="font-weight: bold;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.fonts.PhysicalFonts</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">To conserve resources, y</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">ou can </span><span class="" style="font-family: 'Calibri';">restrict to a subset of</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> fonts </span><span class="" style="font-family: 'Calibri';">installed on your system:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">// Font </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">regex</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> (optional)</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">// Set </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">regex</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> if you want to restrict to some defined subset of fonts</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">// Here we have to do this before calling createContent,</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">// since that discovers fonts</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">String regex = </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">null</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">// Windows:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">// String</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 6.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Consolas';white-space:pre-wrap;">// </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Consolas';">regex</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Consolas';">=".*(</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Consolas';">calibri</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Consolas';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Consolas';">cour</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Consolas';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Consolas';">arial</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Consolas';">|times|comic|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Consolas';">georgia</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Consolas';">|impact|LSANS|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Consolas';">pala</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Consolas';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Consolas';">tahoma</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Consolas';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Consolas';">trebuc</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Consolas';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Consolas';">verdana</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Consolas';">|symbol|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Consolas';">webdings</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Consolas';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Consolas';">wingding</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Consolas';">).*";</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">// </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Mac</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">// String</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">// </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">regex</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">=".*(Courier New|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Arial</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">|Times New Roman|Comic </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Sans</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Georgia</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">|Impact|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Lucida</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> Console|</span></span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Lucida</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Sans</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Unicode</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Palatino</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Linotype</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Tahoma</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Trebuchet</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Verdana</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">|Symbol|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Webdings</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Wingdings</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">|MS </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Sans</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Serif</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">|MS </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Consolas';">Serif</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Consolas';">).*";</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Consolas';">PhysicalFonts.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: 'Consolas';">setRegex</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">(regex);</span><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> </span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Image Handling</span><span class="DefaultParagraphFont " style="font-family: 'Cambria';white-space:pre-wrap;"> - DOCX</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">When you add an image to a document in Word 2007, it is generally added as a new Part (ie you'll find a part in the resulting docx, containing the image in base 64 format).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">When you open the document in docx4j, docx4j will create an image part representing it.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">It is also possible to create a “linked” image.  In this case, the image is not embedded in the docx package, but rather, is referenced at its external location.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Docx4j's </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 10.0pt;;font-family: 'Consolas';">BinaryPartAbstractImage</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';">class contains methods to allow you to create both embedded and linked images (along with appropriate relationships).</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">* Create an image part from the provided byte array, attach it to the </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">* main document part, and return it.*/</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">BinaryPartAbstractImage createImagePart(WordprocessingMLPackage wordMLPackage,</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">      </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';">byte</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">[] bytes) </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">  </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">* Create an image part from the provided byte array, attach it to the source part</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">* (eg the main document part, a header part etc), and return it.*/</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">BinaryPartAbstractImage createImagePart(WordprocessingMLPackage wordMLPackage,</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">      </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">Part sourcePart, </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';">byte</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">[] bytes) </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">* Create a linked image part, and attach it as a rel of the specified source part</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">* (eg a header part)</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">*/</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">BinaryPartAbstractImage createLinkedImagePart(</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">      </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">WordprocessingMLPackage wordMLPackage, Part sourcePart, String fileurl) </span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">For an image to appear in the document, there also needs to be appropriate XML in the main document part.  This XML can take 2 basic forms:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;margin-bottom: 0in;line-height: 100%;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">the Word 2007 </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;;font-family: 'Consolas';">w:drawing</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';">form</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   </span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">&lt;w:p&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">      <span class="" style="font-family: 'Consolas';">&lt;w:r&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">         <span class="" style="font-family: 'Consolas';">&lt;w:drawing&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">            <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">&lt;wp:inline </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">distT</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">="0" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">distB</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">="0" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">distL</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">="0" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">distR</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">="0"</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">&lt;wp:extent </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">cx</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">="3238500" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">cy</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">="2362200" /</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">&lt;wp:effectExtent </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">l</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">="19050" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">t</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">="0" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">r</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">="0" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">b</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">="0" /</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Consolas';">:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Consolas';">&lt;a:graphic &gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                  <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">&lt;a:graphicData </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> ..</span></span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                     <span class="" style="font-family: 'Consolas';">&lt;pic:pic &gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                        <span class="" style="font-family: 'Consolas';">:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                        <span class="" style="font-family: 'Consolas';">&lt;pic:blipFill&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                           <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">a:blip </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">r:embed</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">="rId5"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> /</span></span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                           <span class="" style="font-family: 'Consolas';">:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                        <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">pic:blipFill&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                        <span class="" style="font-family: 'Consolas';">:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                     <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">pic:pic&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                  <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">a:graphicData&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">a:graphic&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">            <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">wp:inline&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">         <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">w:drawing&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">      <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">w:r&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">   <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">w:p&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">the Word 2003 VML-based </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;;font-family: 'Consolas';">w:pict</span><span style="font-family: 'Consolas';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';white-space:pre-wrap;">form</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">   </span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">&lt;w:p&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">      <span class="" style="font-family: 'Consolas';">&lt;w:r&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">         <span class="" style="font-family: 'Consolas';">&lt;w:pict&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">            <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">&lt;v:shapetype </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">id</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">="_x0000_t75" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">coordsize</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">="21600,21600" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> .. </span></span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">&lt;v:stroke </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">joinstyle</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">="miter" /</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Consolas';">&lt;v:formulas&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                  <span class="" style="font-family: 'Consolas';">:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">v:formulas&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Consolas';">:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">            <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">v:shapetype&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">            <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">&lt;v:shape </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">..</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">style</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">="width:428.25pt;height:321pt"</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">v:imagedata </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">r:id</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">="rId4"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Consolas';">o:title</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">="" /</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">            <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';">v:shape&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 12.0pt;">         </span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">&lt;</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">w:pict&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">      <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">w:r&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">   <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">w:p&gt;</span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Docx4j can create the Word 2007 </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;;font-family: 'Consolas';">w:drawing/wp:inline</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';">form for you:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">* Create a </span><span class="DefaultParagraphFont " style="color: #7F7F9F;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">&lt;wp:inline&gt; </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">element suitable for this image,</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">* which can be linked or embedded in w:p/w:r/w:drawing.</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">* If the image is wider than the page, it will be scaled</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">* automatically.  See Javadoc for other signatures.</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">* </span><span class="DefaultParagraphFont " style="color: #7F9FBF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">@param </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">filenameHint Any text, for example the original filename</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">* </span><span class="DefaultParagraphFont " style="color: #7F9FBF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">@param </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">altText  Like HTML's alt text</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">* </span><span class="DefaultParagraphFont " style="color: #7F9FBF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">@param </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">id1   An id unique in the document</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">* </span><span class="DefaultParagraphFont " style="color: #7F9FBF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">@param </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">id2   Another id unique in the document</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">* </span><span class="DefaultParagraphFont " style="color: #7F9FBF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">@param </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">link</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">  true if this is to be </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">linked not embedded</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">*/</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">public </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">Inline createImageInline(String filenameHint, String altText, </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">      </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">int </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">id1, </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">int </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">id2, </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">boolean </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">link) </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">which you can then add to a </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;;font-family: 'Consolas';">w:r/w:drawing.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Finally, with docx4j, you can convert images from formats unsupported by Word (eg PDF), to PNG, which is a supported format.  For this, docx4j uses </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri';">ImageMagick</span><span class="" style="font-family: 'Calibri';">.  So if you want to use this feature, you need to install ImageMagick.  Docx4j invokes ImageMagick using:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">Process p = Runtime.getRuntime().exec(</span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">"imconvert -density " </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">+ density + </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">" -units PixelsPerInch - png:-"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">);</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /></span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Note the name </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri';">imconvert</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">, which is used so that we don't have to supply a full path to exec.  You'll need to accommodate that.  </span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Manual Image Manipulation</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Images involve three things:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">the image part itself</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">a relationship, in the relationships part of the main document part (or header part etc).  This relationship includes:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1.02in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">the name of the image part (for example, </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">/word/media/image1.jpeg</span><span style="font-family: 'Calibri';">)</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1.02in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">the relationship ID</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">some XML in the main document part (or header part etc), referencing the relationship ID (see </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;;font-family: 'Consolas';">w:drawing</span><span style="font-family: 'Consolas';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';white-space:pre-wrap;">and </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;;font-family: 'Consolas';">w:pict</span><span style="font-family: 'Consolas';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';white-space:pre-wrap;">examples above)</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">This means that if you are moving images around, you need to take care to ensure that the relationships remain valid. </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">You can manually manipulate the relationship, and you can manually manipulate the XML referencing the relationship IDs.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Given an image part, you can get the relationship pointing to it </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">Relationship </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">rel = copiedImagePart.getSourceRelationship();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Consolas';">String id = rel.getId();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">You can then ensure the reference matches.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Image Handling – PPTX</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">See the pptx4j </span><a href="https://github.com/plutext/docx4j/blob/master/src/pptx4j/java/org/pptx4j/samples/InsertPicture.java"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">InsertPicture</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> sample.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Adding Headers/Footers</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">See the HeaderFooter sample for how to do this.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Merging Documents</span><span class="DefaultParagraphFont " style="font-family: 'Cambria';white-space:pre-wrap;"> and Presentations</span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';">As</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';"> </span><a href="http://blogs.msdn.com/b/ericwhite/archive/2008/11/03/inserting-deleting-moving-paragraphs-in-open-xml-wordprocessing-documents.aspx"><span class="Hyperlink DefaultParagraphFont " style="color: #AD582A;font-size: 11.0pt;"><span class="" style="font-family: 'Calibri';">Eric White’s blog explained</span></span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';" /><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';">, combining multiple documents can be complicated:</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="DefaultParagraphFont " style="color: #777777;font-size: 11.0pt;;font-family: 'Calibri';">This programming task is complicated by the need to keep other parts of the document in sync with the data stored in paragraphs. For example, a paragraph can contain a reference to a comment in the comments part, and if there is a problem with this reference, the document is invalid. You must take care when moving / inserting / deleting paragraphs to maintain ‘</span><span class="Emphasis DefaultParagraphFont " style="font-weight: bold;color: #777777;font-size: 11.0pt;;font-family: 'Calibri';">referential integrity</span><span class="DefaultParagraphFont " style="color: #777777;font-size: 11.0pt;;font-family: 'Calibri';">’ within the document.</span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';white-space:pre-wrap;">The commercial edition of docx4j includes “MergeDocx” code  which makes merging documents as easy as invoking the method:</span></p>
  
  <p class="Normal DocDefaults "><span class="HTMLCode DefaultParagraphFont " style="font-size: 8.0pt;">   <span class="" style="font-family: 'Consolas';">public</span></span><span class="DefaultParagraphFont " style="font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">  </span></span><span class="HTMLCode DefaultParagraphFont " style="font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';">WordprocessingMLPackage merge(List&lt;WordprocessingMLPackage&gt; wmlPkgs)</span></span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';">In other words, you pass a list of docx, and get a single new docx back.</span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';white-space:pre-wrap;">To try it, visit </span><a href="http://webapp.docx4java.org/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">http://webapp.docx4java.org/</span></a><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';white-space:pre-wrap;" /></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';white-space:pre-wrap;">The commercial edition of docx4j includes </span><span class="DefaultParagraphFont " style="font-size: 11.0pt;;font-family: 'Calibri';">MergePptx, which you can use to concatenate presentations.</span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';white-space:pre-wrap;">The MergeDocx extension can also be used to process a </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 11.0pt;;font-family: 'Calibri';">docx</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';white-space:pre-wrap;"> which is embedded as an</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';"> </span><span class="Strong DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';">altChunk</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';">.  (Without the extension, you have to rely on Word to convert the altChunk to normal content, which means if your docx contains w:altChunk, you have to round trip it through Word, before docx4j can create a PDF or HTML out of it.)</span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';">To process the w:altChunk elements in a docx, you invoke:</span></p>
  
  <p class="Normal DocDefaults "><span class="HTMLCode DefaultParagraphFont " style="font-size: 8.0pt;">   <span class="" style="font-family: 'Consolas';">public</span></span><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="HTMLCode DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';">WordprocessingMLPackage process(WordprocessingMLPackage srcPackage)</span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri';">You pass in a docx containg altChunks, and get a  new docx back which doesn’t.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Table of Contents</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 4mm;line-height: 140%;"><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';white-space:pre-wrap;">The minimal XML docx4j needs to insert into the document for </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;;font-family: 'Calibri';">Microsoft Word</span><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';white-space:pre-wrap;"> to then generate a TOC (including hyperlinks and associated bookmarks), is:</span></p>
  
  <p class="Normal DocDefaults " style="border-color: #FCF9E0; border-style:solid; border-width:1px;background-color: #FCF9E0;margin-bottom: 3mm;line-height: 140%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;;font-family: 'Courier New';">          &lt;w:p&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /><span class="" style="font-family: 'Courier New';">            &lt;w:r&gt;</span><br /><span class="" style="font-family: 'Courier New';">              &lt;w:fldChar w:fldCharType="begin" w:dirty="true"/&gt;</span><br /><span class="" style="font-family: 'Courier New';">            &lt;/w:r&gt;</span><br /><span class="" style="font-family: 'Courier New';">            &lt;w:r&gt;</span><br /><span class="" style="font-family: 'Courier New';">              &lt;w:instrText xml:space="preserve"&gt; TOC \o "1-3" \h \z \u &lt;/w:instrText&gt;</span><br /><span class="" style="font-family: 'Courier New';">            &lt;/w:r&gt;</span><br /><span class="" style="font-family: 'Courier New';">            &lt;w:r&gt;</span><br /><span class="" style="font-family: 'Courier New';">              &lt;w:fldChar w:fldCharType="end"/&gt;</span><br /><span class="" style="font-family: 'Courier New';">            &lt;/w:r&gt;</span><br /><span class="" style="font-family: 'Courier New';white-space:pre-wrap;">          &lt;/w:p&gt;  </span></span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><br /></span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">Generating page numbers is a challenge without Word.</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">The commercial edition of docx4j includes code to generate/update a TOC, including page numbers, based on a basic page layout model.</span><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';white-space:pre-wrap;">  </span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Text extraction</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">A quick way to extract the text from a docx, is to use </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">TextUtils‘  </span></span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">public static void </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">extractText(Object o, Writer w)</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">which marshals the object it is passed via a SAX ContentHandler, in order to output the text to the Writer.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Text substitution</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Text substitution is easy enough, provided the string you are searching for is represented in a </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';white-space:pre-wrap;">org.docx4j.wml.Text </span><span class="" style="font-family: 'Calibri';">object in the form you expect.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">However, that won't necessarily be the case.  The string could be broken across text runs for any of the following reasons:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">part of the word is formatted differently (eg in bold)</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">spelling/grammar</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">editing order (rsid)</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">This is one reason that using data bound content controls is often a better approach (see next section).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Subject to that, you can do text substitution in a variety of ways, for example:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">traversing the main document part, and looking at the </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';white-space:pre-wrap;">org.docx4j.wml.Text </span><span style="font-family: 'Calibri';">objects</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">marshal to a string, search/replace in that, then unmarshall again </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">docx4j‘s XmlUtils also contains:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">     </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">     </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">* Give a string of wml containing ${key1}, ${key2}, return a suitable</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">     </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">* object.*/</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">Object unmarshallFromTemplate(String wmlTemplateString, </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">        </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">java.util.HashMap&lt;String, String&gt; mappings) </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><br /></span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">See the UnmarshallFromTemplate example, which operates on a string containing:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 12.0pt;">   </span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">&lt;w:p&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">      <span class="" style="font-family: 'Consolas';">&lt;w:r&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">         <span class="" style="font-family: 'Consolas';">&lt;w:t&gt;</span></span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Consolas';white-space:pre-wrap;">My favourite colour is </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 10.0pt;;font-family: 'Consolas';">${colour}</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Consolas';">.</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">&lt;</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">w:t&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">      <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">w:r&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">   <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">w:p&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">   <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">&lt;w:p </span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">   <span class="" style="font-family: 'Consolas';">&lt;w:p&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">      <span class="" style="font-family: 'Consolas';">&lt;w:r&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">         <span class="" style="font-family: 'Consolas';">&lt;w:t&gt;</span></span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Consolas';white-space:pre-wrap;">My favourite ice cream is </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 10.0pt;;font-family: 'Consolas';">${icecream}</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Consolas';">.</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">&lt;</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">w:t&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">      <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">w:r&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">   <span class="" style="font-family: 'Consolas';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Consolas';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Consolas';">w:p&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Text substitution via data bound content controls</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">If you have an XML file containing your own data, WordML has a mechansim for associating entries in that XML with content controls in the document.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Then, when you open the document in Word 2007, Word automatically populates the content controls with the relevant XML data, which could even be an image (or with docx4j, arbitrary XHTML)</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">.  (This approach supersedes Word's legacy mail merge fields.  Simple VBA for migrating a document is available at </span><a href="http://blogs.msdn.com/b/microsoft_office_word/archive/2007/03/28/migrating-mail-merge-fields-to-content-controls.aspx"><span class="Hyperlink DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri';">http://blogs.msdn.com/b/microsoft_office_word/archive/2007/03/28/migrating-mail-merge-fields-to-content-controls.aspx</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> )</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">This works using XPath.  A data-bound content control looks something like:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">      </span><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">&lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:sdt</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">        &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:sdtPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">          &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:dataBinding</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 7.5pt;;font-family: 'Consolas';">w:xpath</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">/root[1]/customer[1]</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 7.5pt;;font-family: 'Consolas';">w:storeItemID</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">{428C88D8-C0E3-44F0-B5D7-F65D8B9F7EC9}</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> /&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">        &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:sdtPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">        &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:sdtContent</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">          &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:r</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">            &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:rPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">              &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:rStyle</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 7.5pt;;font-family: 'Consolas';">w:val</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">=</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">PlaceholderText</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Consolas';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> /&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">            &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:rPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">            &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:t</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Consolas';">Click here to enter text.</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:t</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">          &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:r</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">        &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:sdtContent</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">      &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Consolas';">w:sdt</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Consolas';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">You XML file is stored as a part in the docx, typically with a path which is something like customXml/item1.xml.   Note: despite the word "customXml" in the path, this functionality is not affected by the 2009 i4i patent saga.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">If you have a Word document which contains data-bound content controls and your data, docx4j can fetch the data, and place it in the relevant content controls.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">This is useful if you don't want to leave it to Word to do that (for example, you are creating PDFs with docx4j).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Your XML is represented using 2 parts:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">CustomXmlDataStoragePart customXmlDataStoragePart </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Consolas';">= wordMLPackage.getCustomXmlDataStorageParts().get(itemId);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Consolas';white-space:pre-wrap;">CustomXmlDataStorage customXmlDataStorage </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Consolas';">= customXmlDataStoragePart.getData();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">To apply the bindings:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Consolas';">customXmlDataStoragePart.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: 'Consolas';">applyBindings</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">(wordMLPackage.getMainDocumentPart());</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">See further the CustomXmlBinding sample. </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">If you want to create the same document 5 times, each populated with different data, obviously you'd need to insert new XML data first.</span></p>
  
  <p class="Heading2 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Binding extensions for repeats and conditionals</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">A content control is </span><span class="DefaultParagraphFont " style="font-style: italic;;font-family: 'Calibri';">conditional</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> if it (and its contents) are included/excluded from the document based on whether some condition is true or false.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">A content control is a </span><span class="DefaultParagraphFont " style="font-style: italic;;font-family: 'Calibri';">repeat</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> if it designates that its contents are to be included more than once.  For example, a row of a table for each invoice/order item, or person.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">docx4j (from 2.5.0) contains a mechanism for processing conditional content controls and repeats.  See </span><a href="http://www.opendope.org/opendope_conventions_v2.3.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">http://www.opendope.org/opendope_conventions_v2.3.html</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> for an explanation.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">See also the docx4j sample ContentControlBindingExtensions.</span></p>
  
  <p class="Heading2 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Binding escaped XHTML (XML + CSS)</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">docx4j (v2.8.0) can also take encoded XHTML and convert this to docx content.</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> See further OpenDoPE_XHTML.docx in the docx4j docs directory.</span></p>
  
  <p class="Heading2 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Binding other rich content</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">From v3.0.1, docx4j can take docx content (stored in an XML element as escaped Flat OPC XML) and convert this to docx content. </span></p>
  
  <p class="Heading2 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Authoring</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">To set up the bindings, you can use the Word Add-In from </span><a href="http://www.opendope.org/implementations.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">http://www.opendope.org/implementations.html</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">  Please note that you will need to install .NET Framework 4.0 ("full" - the "client profile" is not enough).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Mailmerge</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">docx4j has quite good support for processing fields of type MERGEFIELD (ie the equivalent of doing a mailmerge operation from within Microsoft Word).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">SmartArt</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">docx4j supports reading docx and pptx files which contain SmartArt.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">From docx4j 2.7.0, you can also generate SmartArt.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">To do this, you need:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">the layout definition for the SmartArt, either in the docx already, or from a glox file </span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">an XML file specifying the list of text items you want to render graphically</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">an XSLT which can convert a transformed version of that XML file into a SmartArt data file.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Docx4j can be used to insert the SmartArt parts into a docx; Word or Powerpoint will then render it when the document is opened.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">The code can be found in:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">org.opendope.SmartArt.dataHierarchy</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">org.docx4j.openpackaging.parts.DrawingML, and</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';">src/glox4j/java</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">JAXB stuff</span></p>
  
  <p class="Heading2 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">Cloning</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">To clone a JAXB object, use one of the following methods in XmlUtils:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">/** Clone this JAXB object, using default JAXBContext. */ </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">&lt;T&gt; T deepCopy(T value) </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">  </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">/** Clone this JAXB object */</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">&lt;T&gt; T deepCopy(T value, JAXBContext jc) </span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Ref273527051" /><span class="DefaultParagraphFont " style="font-family: 'Cambria';">javax.xml.bind.JAXBElement</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">One annoying thing about JAXB, is that an object – say a table – could be represented as </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.wml.Tbl</span><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">(as you would expect).  Or it might be wrapped in a </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">javax.xml.bind.JAXBElement</span><span class="" style="font-family: 'Calibri';">, in which case to get the real table, you have to do something like:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">     </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">if </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">( ((JAXBElement)o).getDeclaredType().getName().equals(</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">"org.docx4j.wml.Tbl"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">) ) </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">          </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">org.docx4j.wml.Tbl tbl = (org.docx4j.wml.Tbl)((JAXBElement)o).getValue();</span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">XmlUtils.</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri';">unwrap</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> can do this for you.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">Be careful, though.  If you are intend to copy an unwrapped object into your document (rather than just read it), you'll probably want the object to remain wrapped (JAXB usually wraps them for a reason; without the wrapper, you might find you need an @XmlRootElement annotation in order to be able to marshall ie save your document).</span></p>
  
  <p class="Heading2 Normal DocDefaults "><span class="" style="font-family: 'Cambria';">@XmlRootElement</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Most commonly used objects have an </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Consolas';white-space:pre-wrap;">@XmlRootElement </span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">annotation, so they can be marshalled and unmarshalled.  </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">In some cases, you might find this annotation is missing.  </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">If you can't add the annotation to the jaxb source code, an alternative is to </span><span class="DefaultParagraphFont " style="text-decoration: underline;;font-family: 'Calibri';">marshall</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> it using code which is explicit about the resulting QName.  For example, XmlUtils contains:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">/** Marshal to a W3C document, for object</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Consolas';">*  missing an @XmlRootElement annotation.  */</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">org.w3c.dom.Document marshaltoW3CDomDocument(Object o, JAXBContext jc,</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">      </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">String uri, String local, Class declaredType) </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">You could use this like so:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">CTFootnotes footnotes = </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">        </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">wmlPackage.getMainDocumentPart().getFootnotesPart().getJaxbElement().getValue();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">CTFtnEdn ftn = footnotes.getFootnote().get(1);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">// No @XmlRootElement on CTFtnEdn, so .. </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">Document d = XmlUtils.marshaltoW3CDomDocument( ftn,</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">        </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">Context.jc, Namespaces.NS_WORD12, </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Consolas';">"footnote"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">,  CTFtnEdn.</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Consolas';white-space:pre-wrap;">class </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Consolas';">);</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';white-space:pre-wrap;">Where the problematic object is something you're adding which isn't at the top of the tree, you should add it wrapped in a JAXBElement.  For example, suppose you wanted to add </span><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">FldChar fldchar.  You'd create it in the ordinary way:</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">    </span><span class="" style="font-family: 'Courier New';white-space:pre-wrap;">FldChar fldchar = factory.createFldChar();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri';">but then what you'd actually add to r.getRunContent() is:</span><span class="DefaultParagraphFont " style="color: #000000;">   </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Calibri';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">new</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> JAXBElement( </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">new</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Courier New';white-space:pre-wrap;"> QName(Namespaces.</span></span><span class="DefaultParagraphFont " style="color: #0000C0;font-style: italic;font-size: 8.0pt;;font-family: 'Courier New';">NS_WORD12</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Courier New';white-space:pre-wrap;">, </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Courier New';">"fldChar"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Courier New';">), FldChar.</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Courier New';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Courier New';">, fldchar);</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Courier New';white-space:pre-wrap;"> </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';">An easier way to do this is to find the appropriate method in the object factory (ie the method for creating it wrapped as a JAXBElement).  Use that method signature.  In this example:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Calibri';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #646464;font-size: 8.0pt;;font-family: 'Consolas';">@XmlElementDecl</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">(namespace = </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">"http://schemas.openxmlformats.org/wordprocessingml/2006/main"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">, name = </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Consolas';">"fldChar"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">, scope = R.</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">)</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> JAXBElement&lt;FldChar&gt; createRFldChar(FldChar value) {</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">        </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">return</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">new</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> JAXBElement&lt;FldChar&gt;(</span></span><span class="DefaultParagraphFont " style="color: #0000C0;font-style: italic;font-size: 8.0pt;;font-family: 'Consolas';">_RFldChar_QNAME</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">, FldChar.</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">, R.</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Consolas';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Consolas';">, value);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;">    }</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">The easiest way is to use the </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;">PartsList </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;">online </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">webapp</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> to generate the relevant code.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Other Support Options</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">If the free community support available in the docx4j forum does not meet your needs, or you simply want to outsource some coding, you are welcome to purchase programming, consulting </span><span class="" style="font-family: 'Calibri';">or</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> priority support from </span><a href="http://www.plutext.com/m/index.php/services"><span class="Hyperlink DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Trebuchet MS';">Plutext</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">By purchasing services from Plutext, you support the continued development of docx4j.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Colophon</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">This document was written in Word 2007</span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> (and more recently 2010)</span><span class="" style="font-family: 'Calibri';">, using:</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">XML pretty printed using </span><a href="http://www.softlion.com/webTools/XmlPrettyPrint/default.aspx"><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri';">http://www.softlion.com/webTools/XmlPrettyPrint/default.aspx</span></a><span style="font-family: 'Calibri';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';white-space:pre-wrap;">or Package Explorer</span></p>
  
  <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: 'Calibri';white-space:pre-wrap;">Java source code formatted using </span><a href="http://www.java2html.de"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">http://www.java2html.de</span></a><span style="font-family: 'Calibri';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri';white-space:pre-wrap;">(or cut/pasted from Eclipse)</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';">The PDF and HTML versions were generated using docx4j (PDF via XSL FO and FOP).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Cambria';">Contacting Plutext</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Unless you have paid for support, general “How do I” type questions should be posted directly to the </span><a href="http://www.docx4java.org/forums/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">docx4j forum</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> or StackOverflow.  Plutext may post to the forum any questions it receives by email which should have been directed to the forum.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">Plutext can be contacted at either </span><a href="mailto:jason@plutext.org"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">jason@plutext.org</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;">, or </span><a href="mailto:jharrop@plutext.com"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">jharrop@plutext.com</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults " style="page-break-before: always;"> </p>
  
  <p class="Normal DocDefaults " style="text-align: center;"><span class="DefaultParagraphFont " style="font-weight: bold;text-decoration: underline;"><span class="" style="font-family: 'Calibri';">Appendix 1 – Dependencies by Functionality</span></span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <table class="TableGrid TableNormal " id="docx4j_tbl_6" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 0.14in;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 6.12in;"><colgroup><col style="width: 73.47%;" /><col style="width: 26.53%;" /></colgroup><tbody><tr><td style="background-color: #DDD9C3;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Dependency</span></p></td><td style="background-color: #DDD9C3;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri';">Comment</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- org.slf4j:slf4j-api:jar:1.7.5</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- org.plutext:jaxb-xmldsig-core:jar:1.0.0</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- commons-lang:commons-lang:jar:2.4</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- commons-codec:commons-codec:jar:1.3</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- commons-io:commons-io:jar:1.3.1</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- org.apache.xmlgraphics:xmlgraphics-commons:jar:1.5</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">|  \- commons-logging:commons-logging:jar:1.0.4</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- org.apache.xmlgraphics:fop:jar:1.1</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- org.plutext:jaxb-xslfo:jar:1.0.1</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- org.apache.avalon.framework:avalon-framework-api:jar:4.3.1</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- org.apache.avalon.framework:avalon-framework-impl:jar:4.3.1</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- xalan:xalan:jar:2.7.1</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">|  \- xalan:serializer:jar:2.7.1</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- org.plutext:jaxb-svg11:jar:1.0.2</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- net.arnx:wmf2svg:jar:0.9.0</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- org.apache.poi:poi-scratchpad:jar:3.8</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">|  \- org.apache.poi:poi:jar:3.8</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- org.antlr:antlr-runtime:jar:3.3</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">+- org.antlr:stringtemplate:jar:3.2.1</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';white-space:pre-wrap;">|  \- antlr:antlr:jar:2.7.7 </span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Consolas';">Optional:</span></p>
  
  <p class="dependency-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Consolas';">docx4j-MOXy-JAXBContext-3.0.0.jar</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> +- org.eclipse.persistence:org.eclipse.persistence.moxy:jar:2.5.1</span></span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> |  +- org.eclipse.persistence:org.eclipse.persistence.core:jar:2.5.1</span></span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> |  |  \- org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.5.1</span></span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> |  \- org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.5.1</span></span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';">Logging</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';">diffx</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';">ole introspection</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';">image support</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';">PDF output</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';">PDF output</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';">Font support</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';">(X)HTML, PDF export</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';">Pptx export</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';">OLE, binary import</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';">OpenDoPE</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Consolas';">MOXy JAXB implementation</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p>
  
  <p class="Normal-TableGrid-BR DocDefaults "> </p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "> </p></div>
  
  <div class="footnotes">
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="FootnoteText Normal DocDefaults "><span class="FootnoteReference DefaultParagraphFont " style="vertical-align: top; font-size: xx-small"><a name="fn1"><a href="#fs1">1</a></a></span><span class="" style="font-family: 'Consolas';white-space:pre-wrap;"> </span><a href="#null"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri';">http://forums.java.net/jive/thread.jspa?threadID=411</span></a><span class="" style="font-family: 'Consolas';white-space:pre-wrap;" /></p>
  
  <p class="FootnoteText Normal DocDefaults "><span class="FootnoteReference DefaultParagraphFont " style="vertical-align: top; font-size: xx-small"><a name="fn2"><a href="#fs2">2</a></a></span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> If you get the error 'Access restriction: The type</span><span class="apple-converted-space DefaultParagraphFont " style="font-family: 'Calibri';"> </span><span class="underline DefaultParagraphFont " style="font-family: 'Calibri';white-space:pre-wrap;">is not accessible due to restriction on required library rt.jar' (perhaps using some combination of Eclipse 3.4 and/or JDK 6 update 10?), you need to go into the Build Path for the project, Libraries tab, select the JRE System Library, and add an access rule, "Accessible, **". </span></p>
  
  <p class="FootnoteText Normal DocDefaults "><span class="FootnoteReference DefaultParagraphFont " style="vertical-align: top; font-size: xx-small"><a name="fn3"><a href="#fs3">3</a></a></span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> </span><a href="#null"><span class="Hyperlink DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri';">http://blogs.msdn.com/b/dmahugh/archive/2009/01/16/ecma-376-implementation-notes-for-office-2007-sp2.aspx</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /></p>
  
  <p class="FootnoteText Normal DocDefaults "><span class="FootnoteReference DefaultParagraphFont " style="vertical-align: top; font-size: xx-small"><a name="fn4"><a href="#fs4">4</a></a></span><span class="" style="font-family: 'Calibri';white-space:pre-wrap;"> </span><a href="#null"><span class="Hyperlink DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri';">http://blogs.msdn.com/b/dmahugh/archive/2010/04/06/office-s-support-for-iso-iec-29500-strict.aspx</span></a><span class="" style="font-family: 'Calibri';white-space:pre-wrap;" /></p></div>
  
  
  
  
  
  <!-- userBodyTail goes here -->
  
  </body></html>